Skip to content

Fix autocomplete not triggering on mobile (CM5 input handling)#4017

Open
aashu2006 wants to merge 1 commit intoprocessing:developfrom
aashu2006:fix/mobile-autocomplete
Open

Fix autocomplete not triggering on mobile (CM5 input handling)#4017
aashu2006 wants to merge 1 commit intoprocessing:developfrom
aashu2006:fix/mobile-autocomplete

Conversation

@aashu2006
Copy link
Copy Markdown
Contributor

Issue:

Fixes #4007

This PR builds on the issue identified and discussed by @skyash-dev and me at Discord. We focused on investigating the mobile input behavior in CodeMirror and then I implementing a fix for the autocomplete trigger.

Autocomplete suggestions were not triggering reliably on mobile devices due to differences in CodeMirror’s input handling (IME + contenteditable path in CM5)

Demo:

Tested on a real Android device (Chrome). Autocomplete now appears while typing with the virtual keyboard.

Changes:

  • Added mobile compatible autocomplete triggering using:
    • change (desktop input)
    • compositionend (word commit on mobile)
    • compositionupdate (IME typing support)
  • Introduced triggerHint helper to unify logic
  • Handled trailing spaces e.g. "bac " to ensure correct token detection
  • Cleaned up debug code and simplified the logic

Notes:

  • This PR focuses on fixing the autocomplete trigger issue on mobile (CM5).
  • Keyboard focus behavior (virtual keyboard closing on suggestions) is not addressed here and I am thinking of handling it separately from this.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
  • meets the standards outlined in the accessibility guidelines

@aashu2006
Copy link
Copy Markdown
Contributor Author

@raclim would appreciate your thoughts here as well, especially since this relates to the earlier discussion around mobile autocomplete behavior, thanks!

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.

Autocomplete suggestions not working consistently on mobile devices

1 participant