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

Detecting if a virtual keyboard will open if an element gets focus #402

Open
frederikcreemers opened this issue Jul 6, 2022 · 1 comment

Comments

@frederikcreemers
Copy link

In our chat application, we often move focus back to the message field after an action such as deleting a message has been performed. Unfortunately, this opens up the virtual keyboard in many cases, so we disable this behavior if we think we're on a mobile device. We currently check this using screen size, but that's not a great heuristic.

It would be great if there were a way to check if moving focus to an input or contentEditable element would cause an on-screen keyboard to open. We might be able to solve this with the inputPanelPolicy proposed in #225, but that would mean blocking the keyboard by default, and then re-enabling it in the cases when we want it to appear, and I'd prefer to do it the other way around.

@snianu
Copy link
Contributor

snianu commented Jul 6, 2022

@bigblind You could also set the virtualKeyboardPolicy to manual on focus and then switch the value to auto after focus is inside the editable element. That way the VK won't show up automatically on focus, but it will if the user taps on the editable element. The virtualKeyboardPolicy attribute is described here.

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

No branches or pull requests

2 participants