-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
fix selecting mention element in android, can't evoke the keyboard #5298
base: main
Are you sure you want to change the base?
Conversation
|
@BitPhinix please review! |
Not a huge fan of this approach. Having the nodes contenteditable will likely mess with autocomplete and unexpected behaviour especially on more complex void nodes. There are other hacks to prevent the keyboard from closing when selecting inline void nodes, like adding pseudo elements with (zero-width) spaces around them via css. |
Allright, I'd try the pseudo elements method. |
@BitPhinix can you provide an example of the approach you had in mind? I played with a few different variations using |
I use the following component for fixing this in general for inlines, not sure if this resolves your issue on android though. You use it by placing this before and after
|
@bryanph I tried different variations of your suggestion on Android but haven't had any success so far. The only solution I've found that works so far is the one described in this PR, but I would love if we could find a solution that doesn't involve consumers having to handle Android-specific edge cases in the markup of their inline void nodes. |
Description
In android, once selecting an inline void element, the keyboard doesn't be evoked, unless we set it's contenteditable to be true, like below
But it will make the children (a zero width node) to be contenteditable. So we should disable it's inputting at the beforeinput event.
Issue
Fixes: #5183
Example
https://www.slatejs.org/examples/mentions
before:
before-void.mp4
after:
after-void.mp4
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)