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

Keyboard can pop up on returning from lightbox or internal link #1100

Open
gnprice opened this issue Dec 4, 2024 · 1 comment
Open

Keyboard can pop up on returning from lightbox or internal link #1100

gnprice opened this issue Dec 4, 2024 · 1 comment
Assignees
Labels
a-compose Compose box, autocomplete, attaching files/images a-msglist The message-list screen, except what's label:a-content beta feedback Things beta users have specifically asked for
Milestone

Comments

@gnprice
Copy link
Member

gnprice commented Dec 4, 2024

Repro:

  • On Android, visit a message list that has a compose box.
  • Touch the content input to focus it. The keyboard appears.
  • Dismiss the keyboard using either (a) the "back" gesture or button or (b) the keyboard's own button for being dismissed. The keyboard will vanish, making room again for the full height of the message list.
  • Now scroll around the message list reading messages, and forget that you'd previously interacted with the compose box.
  • Then open some other page within the app, by doing any of the following:
    • Tap on some image or video, opening the lightbox.
    • Or tap an internal link in a message, opening a new message-list page.
    • Or tap a message sender's name or avatar, opening their profile page.
    • Or etc.
    • (On the other hand: if you tap an external link, opening a web browser within the app, then that will not reproduce this issue.)
  • Navigate back out of the other page, using either (a) the "back" gesture or button or (b) the "back" or "close" button in the app bar.
  • Expected: The message list reappears, looking the same as it did when you entered the lightbox.
  • Actual: The message list reappears, but the keyboard pops up, occupying a swath of the screen.

This is a variant of #1097, and I assume it has the same root cause: after dismissing the keyboard in step 3 above, the text field is still focused. When it occurs, this symptom is much more obtrusive and annoying.

I learned about this symptom the other day from a longtime Zulip user who was trying out the Flutter beta app; he ran into this within the first few minutes.

@gnprice gnprice added the beta feedback Things beta users have specifically asked for label Dec 4, 2024
@gnprice gnprice added this to the M5: Launch milestone Dec 4, 2024
@gnprice gnprice added a-msglist The message-list screen, except what's label:a-content a-compose Compose box, autocomplete, attaching files/images labels Dec 4, 2024
@gnprice
Copy link
Member Author

gnprice commented Dec 4, 2024

I think there are basically two strategies for solving this:

  • Figure out why navigating back opens the keyboard, and make it not do so.

    The keyboard's appearing has to fundamentally be under our control, because it can be triggered by the "back"/"close" button in an app bar. That's a gesture that's meaningful only to the app and the Flutter framework — the OS doesn't know anything about it — so the framework must be doing something that signals the keyboard to appear, presumably from the navigator code.

    OTOH in situations where a text field is focused and the keyboard is open, it might be annoying if navigating to some other page and back caused the keyboard to go away.

  • When the user dismisses the keyboard, unfocus the text field too.

    I'm not sure if there's a clean way to make this happen — to notice specifically when the keyboard gets dismissed. A crude hack that'd mostly work would be to watch for changes to our viewport that look like the keyboard getting dismissed.

  • (A third strategy I don't intend to use: we could pass ScrollViewKeyboardDismissBehavior.onDrag to the message list's scroll view, so that trying to scroll causes the keyboard to vanish and the text input to lose focus. See reasoning in chat for why this would be annoying behavior.)

The second strategy is what Discord does. (I don't know if they've found a clean way to do it or are using that crude hack.)

  • Or at least they cause the blinking cursor to disappear from the text field when the keyboard is dismissed. I take the lack of cursor as indicating a lack of focus.

The first strategy is what Facebook Messenger does and what Slack does.

  • In Slack's case, opening the lightbox and coming back also has the side effect that the text field loses focus — or anyway the blinking cursor in it disappears.
  • In FB Messenger, that side effect doesn't occur: the blinking cursor remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-compose Compose box, autocomplete, attaching files/images a-msglist The message-list screen, except what's label:a-content beta feedback Things beta users have specifically asked for
Projects
Status: No status
Development

No branches or pull requests

2 participants