-
Notifications
You must be signed in to change notification settings - Fork 5.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
Better handling of text composition #3635
Conversation
This seems to fix #2038 and a bunch others. |
This works great on Android! <3 |
The Live autocompletion in the kitchen sink demo doesn't show on Chrome for Android. It does show on the master branch |
8a1f4a6
to
ce475c0
Compare
Codecov Report
@@ Coverage Diff @@
## master #3635 +/- ##
==========================================
+ Coverage 67.21% 68.09% +0.87%
==========================================
Files 483 485 +2
Lines 47927 48191 +264
Branches 9106 9138 +32
==========================================
+ Hits 32214 32814 +600
+ Misses 15713 15377 -336
Continue to review full report at Codecov.
|
Thanks for testing! The new version should fix issues with autocompletion and backspace. |
67179b4
to
c51eea3
Compare
43bda90
to
1b96c9e
Compare
https://rawgit.com/ajaxorg/ace/master/kitchen-sink.html
Overview
Textinput stores selection and value of textarea
After input event, sendtext checks the difference from the last value, and detects what change is needed to get from old value to the new one.
The normal case of inserting text goes through the old codepath, and there is a new handler for the case when selection needs to be modified before or after the insertion.
textarea size is set to 1px (0 on ie to hide the blinking cursor) comment in monaco was saying that there is an issue with setting it 0 on all browsers.
Font size is set to 1px on desktop, to make sure the text in textarea doesn't change the position of ime popup much, and inherit on mobile to not trigger zoom on focus
After endOperation events value of textarea is set to the current line (two lines around the cursor for multiline selections) this allows screen readers to work the same way as in textarea, and also helps with mobile keyboards that do not fire proper events
For the composition there are two modes
On chrome and firefox we set textarea value to "", make textarea visible, and add a placeholder token under it, this allows the native underline to be visible, which has information about word boundaries
on other browsers we keep textarea hidden, insert text into the document and add a marker for the underline (this is needed because on mobile all text input goes through composition events, and on ie setting value to "" from composition start doesn't work)
Testing
Manually tested windows, linux, mac with combinations of ie11, chrome, firefox, safari, for japanese and korean ime
android: chrome and firefox with gboard, samsung keyboard, swiftkey, hackers keyboard