-
-
Notifications
You must be signed in to change notification settings - Fork 111
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(web): prevents selection-clear for pure layer-switching multitaps #11232
Conversation
User Test ResultsTest specification and instructions
|
// Has there been a context change at any point during the multitap? If so, we need | ||
// to revert it. If not, we assume it's a layer-change multitap, in which case | ||
// no such reset is needed. | ||
if(!isEmptyTransform(transcription.transform) || !transcription.preInput.isEqual(Mock.from(outputTarget))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why both?
transcription.transform
(and in fact,transcription
in general) does not provide any indication of deadkey changes.- While certainly "bad keyboard design", there's nothing preventing a multitap component of a layer-switch key from manipulating the context. Should that occur, the correct thing to do is still to rewind the context.
Note that it is technically possible to have altered the context since the base tap... but if the current context state matches the original one anyway, there's no need to perform a reset - we've already done the rewind in one manner or other.
We're only safe to bypass the context-rewind mechanism if there truly has been no change to the context whatsoever. Deadkey changes are context changes, and to handle them requires the some of the special handling newly added by this PR.
return this.text == other.text | ||
&& this.selStart == other.selStart | ||
&& this.selEnd == other.selEnd | ||
&& this.deadkeys().equal(other.deadkeys()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone goes and makes a multitap key that only does deadkey stuff, the final check is required to be able to rewind deadkey manipulations. Otherwise, we'd get a lot of excess deadkeys during such a multitap due to not erasing deadkeys from taps before the final one.
Test Results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jahorton Tested the same in an Android 13 Mobile and it seems to be working as expected. |
Test Results
|
Changes in this pull request will be available for download in Keyman version 17.0.309-beta |
Fixes #11230.
Previously, we always cleared the selection as part of resetting the context-state for multitaps. Problem is... that has unwanted cross-effects if the only thing the multitap is doing is to layer-switch.
It's possible to shorten the changes with a "naive" fix, but naive solutions don't account for potential deadkey solutions very well. I figure it's best to nip all such issues in the bud now, especially since I don't think there are related preventative warnings and/or errors for keyboard developers in Developer.
User Testing
Any Web-based touch-platform will suffice for these tests.
TEST_CAPS_WITH_SELECTION: Verify that selected text is not erased when double-tapping SHIFT to enter a keyboard's caps-lock state. (A direct repro attempt for #11230.)
TEST_MULTITAP_ROTA: Using a keyboard with multitap keys that output text, verify that the output text is properly replaced on each tap.
ye_old_ten_key
anddiacritic_rota
from https://jahorton.github.io/ should work.