Fix Android virtual keyboard search autocompletion bugs#213
Draft
Fix Android virtual keyboard search autocompletion bugs#213
Conversation
There's two bugs, basically:
1. When using the Android virtual keyboard, `event.key` is always
`Unidentified` and `event.code` always 229, meaning we have no way
to detect if some text got inserted (in which case autocompletion
should trigger) or some was deleted (in which case it shouldn't as
that'd mean the selected autocompletion text erased from the back
would get immediately added again). To work around that, we detect
Shitty Android and defer the autocompletion enablement to an
inputEvent that's triggered right after and which contains the data
we need.
2. Calling setSelectionRange() directly in code will make the browser
*render* the selection, but the remote keyboard isn't for some
reason aware of the fact, and thus pressing backspace on that
keyboard won't delete anything, only remove the highlight. To fix
this, one has to defer the call to setSelectionRange() to a timeout,
then it behaves properly.
And then, then there's Firefox Mobile, which is a whole other problem.
That gets tackled in the next commit.
FFS. FFS. TODO: this is a huge piece of shit code added all over the place AND YET it still doesn't work as intended. Giving up.
This was referenced Jan 6, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Originally an attempt to actually fix #196 instead of disabling the autocompletion altogether on affected browsers as was done in b598223. Didn't get very far and the code already started to look extremely horrendous, so I gave up. Things to do:
Leaving it here in case someone in the future would have the guts and preserverance to look at this cursed problem again.