-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
refactor(web): longpresses, groundwork for additional gestures 🍕 #5387
Conversation
… into refactor/web/osk-centralized-gestures
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.
I have no remaining comments, just awaiting final re-test from @MakaraSok for approval.
I'm trying to setup and test |
I think I got the keymanweb install using the instructions here https://github.com/sillsdev/keyman/wiki/How-to-set-up-a-local-web-server-for-the-Keyman-web-pages. Can you guide me further on what to do next to test this PR? |
That'll get you to the standard, "unminified" test page I suggested in the testing notes. Assuming you're using either Chrome or Firefox, be sure to use Developer mode to emulate a touch device. Though, I think you're familiar with what that entails. |
Dang it... I put the wrong ID: it's |
'in-browser' KMW on iPhone X / iPad Pro / Pixel 2 -
|
Have you tried loading it via the globe key yet? iOS doesn't auto-swap out the default keyboard - that'll be different than how (I think) Android does it. Via a longpress on the default system keyboard: Select Keyman to get it loaded. As for your other recent messages, we need to chat through other channels. I can't reproduce any of the errors in your most recent postings. |
Looks like much of that was, indeed, a classic scenario of the old version arising. Not sure if it was because of Chrome caching or an old build being used by accident. There were three things that we noted that are worth addressing in some form:
|
And... may as well go ahead and (for non-embedded cases) auto-select & highlight the base key until the user moves their finger, triggering initial subkey selection. No reason to maintain such an arbitrary condition of "if not moved, don't emit, but if moved even one pixel, emit.) |
After a remote session with Joshua, it turns out that the tests done on KMW was not prep thoroughly.
These are no longer an issue. Trigger a longpress gesture on shift's W, but 'cancel' it by moving your finger back to the main key, then release. It results in a standard keypress for that key. The key is also nicely highlighted to notify what is being pressed and triggered the output. These issues here #5387 (comment) and #5387 (comment) have also been quickly fixed on the fly. No highlighted key will be left after being released on Android/iOS. This issue #5387 (comment) was purely technical as there was a step which can be done to show the OSK keyboard from the I/O menu on the Simulator. This is not Keyman's issue. |
@MakaraSok @jahorton What is the current status of testing on this PR? Have all tests passed to your satisfaction? |
Indeed. |
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
Changes in this pull request will be available for download in Keyman version 15.0.83-alpha |
This accomplishes the same goals as the "subkey abstraction" series, just in a single PR instead of multiple. The goal: to modularize how KMW handles longpresses in order to display subkeys. Since it's accomplishing the same work as that series, much of #5294's description is also relevant here.
This modularization actually gives rise to two nice interfaces that should prove useful when we look to add support for additional input gesture types, such as
flick
andmultitap
from the LDML spec. We aren't implementing those now, but this groundwork will facilitate their development once we're ready.A few pieces especially worth highlighting:
keyman/web/source/osk/pendingGesture.interface.ts
Lines 2 to 8 in 6034f25
PendingGesture
- can model a longpress gesture that has not yet been confirmed, thus does not block base-key interactions / change of highlighted keykeyman/web/source/osk/realizedGesture.interface.ts
Lines 2 to 9 in 6034f25
RealizedGesture
- can model a confirmed longpress gesture that has displayed subkeys but not yet completed (as in, hasn't yet returned a subkey)Toward new input gestures in the future
The abstractions from the previous block also provide a starting point to, in the future, model LDML's flick and the multitap attribute.
flick
events.Promise
s can be built pre-resolved, after all.multitap
may make this a bit more complex, but it'll be manageable via some sort of state machine if so.multitap
doesn't clear for new touches (on the same base key) when others would, as it is a gesture across multiple touches.RealizedGesture.promise
typing may need a minor rework, asPromise
s may only resolve once. That's a bridge we can cross when we come to it, though.We'll probably want some sort of formalized "gesture engine" before implementing either. Design pending, of course, though at least the new abstractions will greatly facilitate that process.
Unit testing
@MakaraSok
As this PR is a focused rework of the longpress gesture, we'll want a fairly extensive round of tests that ensure functionality has been maintained. While I've done so myself, it's always wise to get extra perspectives; it's possible I may have missed something.
There are two test suites I can specify that focus well on certain niches of KMW longpress behavior. The more platforms we can test against, the better. There's also a third suite to check for possible cross-effects with predictive text.
The most important test device configurations:
All other configurations use 'in-browser' implementations rather than 'embedded', so pick one or two from the "exhaustive" list below.
If we want exhaustive testing:
1.
sil_cameroon_qwerty
Of particular interest: the
W
andE
keys on the shift layer have subkeys set withlayer = default
andnextlayer = default
. (Most of the keys on the 'shift' layer are set with the samenextlayer
property.) Of course, there are a lot of other subkeys as well - but be especially sure to testW
andE
- they're the most niche and therefore most prone to breakage. Test some subkeys on the default layer as well -w
ande
should be fine.Naturally, the subkeys on the
default
layer do not layer shift.All tested subkeys should output the text seen on their keycap. For any keys on the shift layer that automatically change layer to the 'default' layer (including
W
andE
), their subkeys should do the same. (Specified by the keyboard's developer; this isn't a general, hard and fast rule for all keyboards.)For some extra rigor:
The symbolic layer also has a few keys with subkeys that layer-shift:
<<
and>>
)'
and double-quote""
keysIt also has keys with subkeys that don't layer shift:
(
,)
?
,!
The keyboard's unique layers (using the tricolored key) do not possess any subkeys.
Finally, some other patterns to test with this keyboard: use a longpress gesture on shift's
W
, but 'cancel' it by moving your finger back to the main key, then release. It should result in a standard keypress for that key.w
and a couple of other subkeys.2.
basic_khmr
As the distributed version of its package doesn't include the JS, I've handmade a version that includes it. This is only needed for tests within the Keyman apps: basic_kbdkhmr.kmp.zip
For tests against 'in-browser' KMW, simply load the
basic_khmr
(Khmer Basic) keyboard. The standard unminified testing page should suffice.This keyboard does not specify a touch layout, so it uses the default one constructed by KMW. This results in a keyboard with subkeys on SHIFT that exist solely to change the current layer - no output. The embedded-mode's subkey-processing code path has received a few simplifications that could affect such keys; please ensure that the keyboard shifts layers as expected when using SHIFT's subkeys.
These layer-shifting subkeys should only exist on the default layer; other layers should directly return to the default layer when the layer-shift key is pressed.
So, try testing the following layer-shift subkeys:
Finally, one last bit of testing with this keyboard: use a longpress gesture on shift, but 'cancel' it by moving your finger back to the main key, then release. It should layer-shift to the "shift" layer.
3.
sil_euro_latin
(English)While most of the subkey handling is well-handled by the tests established above, there's one last thing that's important to consider: subkeys can be used in predictive text.
When typing words and using subkeys, do unreasonable predictions arise? Do predictions arise when expected? (Note that subkeys should be considered 'replaceable' with their base key. For example, when using the
ŝ
subkey you should expect corrections that replace it with a plains
.)