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

Fix Android virtual keyboard search autocompletion bugs #213

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mosra
Copy link
Owner

@mosra mosra commented Jan 6, 2022

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:

  • The first commit should be probably enough to fix all issues on Chrome, except for duplicated characters when overwriting autocompletion as noted in Search.js in doxygen documentation module not working on mobile #196
  • Pressing (virtual) backspace on Firefox will randomly add an autocompletion highlight due to Firefox taking three input events to delete a highlight. Very annoying.
  • The mess added in the second commit to step around Firefox misfeaturebugs will probably break the behavior elsewhere
  • The code needs a cleanup / rework to make it maintainable again, TODOs removed, comments clarified

Leaving it here in case someone in the future would have the guts and preserverance to look at this cursed problem again.

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.
@mosra mosra added this to TODO in Python theme via automation Jan 6, 2022
@mosra mosra added this to TODO in Doxygen theme via automation Jan 6, 2022
@mosra mosra added help wanted Suitable for a community contribution. laterz Will get resolved eventually, but not now. labels Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Suitable for a community contribution. laterz Will get resolved eventually, but not now.
Projects
Doxygen theme
  
TODO
Python theme
  
TODO
Development

Successfully merging this pull request may close these issues.

Search.js in doxygen documentation module not working on mobile
1 participant