Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep compose box scrolled to bottom, not top, as you type a long message #3614

Closed
gnprice opened this issue Sep 16, 2019 · 6 comments · Fixed by #3750
Closed

Keep compose box scrolled to bottom, not top, as you type a long message #3614

gnprice opened this issue Sep 16, 2019 · 6 comments · Fixed by #3750
Assignees
Labels
a-compose/send Compose box, autocomplete, camera/upload, outbox, sending a-iOS a-layout

Comments

@gnprice
Copy link
Member

gnprice commented Sep 16, 2019

Since we fixed #3369 with #3595 , the compose box is now scrollable so you can see what you're typing even in the later part of a long message.

But it doesn't automatically scroll itself that way; by default it sticks at the top, and you have to scroll it yourself. See report in chat, with a video.

I'm not sure what the right logic might be for a complicated case where the user is moving to and fro in the message and editing different parts of it. Let's declare the problem of getting that exactly right to be out of scope for this issue.

The most common case is that the user mostly types additional text at the end, and perhaps occasionally scrolls up to edit an earlier part of the message. Let's make that case work such that as long as you're at the end, there's no manual scrolling needed.

@gnprice gnprice added a-layout a-compose/send Compose box, autocomplete, camera/upload, outbox, sending labels Sep 16, 2019
@jainkuniya
Copy link
Member

This issue is easily reproducible on iOS. On Android it gets automatically scrolled up on typing.

If we revert #3595, then it will get fixed. But then #3369 will occur on Android.

Next will try to find out a simple common solution.

@gnprice gnprice added the a-iOS label Nov 6, 2019
@gnprice
Copy link
Member Author

gnprice commented Nov 6, 2019

Thanks @jainkuniya ! Just to make things explicit:

This issue is easily reproducible on iOS. On Android it gets automatically scrolled up on typing.

I believe you're saying this issue doesn't reproduce on Android.

The original user report of the issue was on iOS, so that's consistent too.

@jainkuniya
Copy link
Member

This compose box issue is only issue on screen when there are multiple input on the screen, like stream narrow (not topic or PM narrow).

Root cause is: Topic input always try to remain in the window/screen, even when message input expands. So only way left for message input to expand is to expand at bottom, instead of top.

@gnprice
Copy link
Member Author

gnprice commented Nov 27, 2019

Root cause is: Topic input always try to remain in the window/screen, even when message input expands. So only way left for message input to expand is to expand at bottom, instead of top.

Ah interesting. Are there particular experiments you've done, or things you've observed, that lead to this diagnosis?

jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Dec 1, 2019
…eachable."

This reverts commit 3574b12.

This was not a right fix, it introduced zulip#3614.
So reverting it. Also see futher commit for right fix.
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Dec 1, 2019
Add `justifyContent` as `flex-end` in `composeText`, which is a wrapper
style of inputs (topic and msg).

Default value is `flex-start`. Which indicates that place components at
the start of the parent and grow in the other direction if required.
With `flex-end`, it means place component at the end of the parent and
grow at the start if required.

Fixes: zulip#3614
@gnprice
Copy link
Member Author

gnprice commented Dec 4, 2019

There were a couple of different attempted fixes in the PR #3690, but they didn't 100% work, and it seems like we don't yet understand the cause of this issue. Let's focus first on investigating the issue, so we can understand what's going on; then once we understand it, we can fix it.

Copying here a version of some of my comments there, as well as more summary of our conversation just now:

For the investigation let's focus on iPhone models without a notch -- so e.g. an iPhone 8 but not an iPhone X. The notch pulls in an unrelated bug (#3066) that causes overlapping symptoms, which confuses the issue.

It looks like the core issue here is that the content input is too tall. In the extreme case the input is too tall for the whole input to be shown at all; in other cases it's itself shown in full, but it crowds out the topic input, or the unreads banner.

The normal way the layout should work is:

  • ChatScreen has some height, which it's given by what's outside it. This might be the height of the screen, or the screen minus the keyboard, or we might be in some kind of split-screen or multi-window situation. We shouldn't try to guess about that -- it just gets a height from its parent in the normal way.
  • Then some of that height goes to e.g. the navbar, and Chat has a height that's what's left over.
  • Then in Chat... something happens in KeyboardAvoider, and maybe that's part of the bug. That'd fit with being iOS-specific, too, because that's basically a no-op on Android.
  • After that, UnreadNotice and so on have a height; MessageList and ComposeBox will take the rest. This is what flexbox is for, and in particular the end result should be that ComposeBox effectively has a max height given by the layout of Chat.
  • Then inside ComposeBox, again some height goes to the topic input, and what's left is a max height for the content input.

Evidently that's breaking down somewhere. So a key part of the task is to figure out where.

You'll want to investigate the layout of the React components in the app. Try the React debugger; there's documentation in the RN docs on debugging.

jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Dec 7, 2019
…eachable."

This reverts commit 3574b12.

This was not a right fix, it introduced zulip#3614.
So reverting it. Also see futher commit for right fix.
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Dec 7, 2019
Now max height is set to composeBox, so when msg input expands it takes
all the space available in the parent and pushes topic input outside.

The workaround of this is to set position of topic input absolute and
adjust position of msg input accordingly with the help of marginTop.

Fixes: zulip#3614
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Dec 7, 2019
…eachable."

This reverts commit 3574b12.

This was not a right fix, it introduced zulip#3614.
So reverting it. Also see futher commit for right fix.
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Dec 7, 2019
Now max height is set to composeBox, so when msg input expands it takes
all the space available in the parent and pushes topic input outside.

The workaround of this is to set position of topic input absolute and
adjust position of msg input accordingly with the help of marginTop.

Fixes: zulip#3614
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 2, 2020
…eachable."

This reverts commit 3574b12.

This was not a right fix, it introduced zulip#3614.
So reverting it. Also see futher commit for right fix.
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 2, 2020
Add flex-shrink: 1 to msg input, compose box and compose box wrapper.
This will prevent it to overflow parent on huge multiline text msg input.

This style needs to be applied for msg input hierarchy to get affected.

Fixes: zulip#3614
@gnprice
Copy link
Member Author

gnprice commented Jan 2, 2020

(For cross-reference: we had a very informative chat thread about this here.)

jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 3, 2020
Add flex-shrink: 1 to msg input, compose box and compose box wrapper.
This will prevent it to overflow parent on huge multiline text msg input.

This style needs to be applied for msg input hierarchy to get affected.

Fixes: zulip#3614
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 14, 2020
…eachable."

This reverts commit 3574b12.

This was not a right fix, it introduced zulip#3614.
So reverting it. Also see futher commit for right fix.
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 14, 2020
Add flex-shrink: 1 to msg input, compose box and compose box wrapper.
This will prevent it to overflow parent on huge multiline text msg input.

This style needs to be applied for msg input hierarchy to get affected.

Fixes: zulip#3614
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 22, 2020
…eachable."

This reverts commit 3574b12.

This was not a right fix, it introduced zulip#3614.
So reverting it. Also see futher commit for right fix.
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 22, 2020
Add flex-shrink: 1 to msg input, compose box and compose box wrapper.
This will prevent it to overflow parent on huge multiline text msg input.

This style needs to be applied for msg input hierarchy to get affected.

Fixes: zulip#3614
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 22, 2020
…eachable."

This reverts commit 3574b12.

This was not a right fix, it introduced zulip#3614.
So reverting it. Also see futher commit for right fix.
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jan 22, 2020
Add flex-shrink: 1 to msg input, compose box and compose box wrapper.
This will prevent it to overflow parent on huge multiline text msg input.

This style needs to be applied for msg input hierarchy to get affected.

Fixes: zulip#3614
jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Jul 19, 2020
Remove scroll view from input wrapper (which was added in zulip#3595).
This fixed zulip#3614. Also just checked it works fine on Android as well. So
basically zulip#3595 was not a completely right solution for zulip#3369.

Now inputs are wrapped with simple view, which is self aligned as
vertically center. ComposeMenu and SendButton are self aligned as
vertically end. And wrapper of all this three has justifyContent
as space-between, which makes them spread whole over horizontal space
available.

This removes alignItems: 'flex-end' from `composeBox`, which was pushing
input to vertically bottom, idealy it should be at vertically center.

Fixes: zulip#3614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-compose/send Compose box, autocomplete, camera/upload, outbox, sending a-iOS a-layout
Projects
None yet
2 participants