8000 Add the ability to dismiss the keyboard by tapping outside of the text area by polemarkh · Pull Request #429 · commetchat/commet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add the ability to dismiss the keyboard by tapping outside of the text area #429

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

polemarkh
Copy link
Contributor

This adds a widget, DismissKeyboard, that dismisses the keyboard when the focus is no longer in a text field, and wraps the KeyboardAdaptor widget in that widget. The net result is that, if you tap in the area around the message input (but not in the text field), the keyboard will go away. This provides a way to dismiss the keyboard on iOS, which doesn't have a button to dismiss the keyboard normally by default.

It would also be possible to wrap the entire application in the widget, which would mean tapping anywhere outside of the input area would close the keyboard, but I decided to start small here, and I didn't want to mess around with main.dart quite yet.

It should have no effect on any device with a hardware keyboard.

Copy link
Contributor
@Airyzz Airyzz Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code shouldn't be necessary, and the desired behavior was already implemented previously. It seems that the recent change setting keyboardType: TextInputType.text on the TextField prevented the behaviour, which I am correcting in #435

Please remove

@Airyzz
Copy link
Contributor
Airyzz commented Mar 21, 2025

I think this is a good idea, however I'm not sure wrapping the entire area with this widget is the right approach, as it means tapping in any small gaps (such as between the attachment add button and the text area) would dismiss the keyboard, which is probably not the users intent.

Maybe it would make more sense for a short tap on any message/timeline event would dismiss the keyboard? as that action isn't currently used for anything.

While we are looking at ways to dismiss keyboard, I think we should also dismiss the keyboard when swiping to reveal either the room list / user list panels, as the text input is mostly off screen and doesn't make sense to be focused, but this can be added in a seperate PR later if you dont want to work on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0