Skip to content

feat(web): previewing gestures - common phone, tablet styling + flick animations 🐵#9825

Merged
jahorton merged 33 commits intofeature-gesturesfrom
feat/web/gesture-preview-host
Nov 14, 2023
Merged

feat(web): previewing gestures - common phone, tablet styling + flick animations 🐵#9825
jahorton merged 33 commits intofeature-gesturesfrom
feat/web/gesture-preview-host

Conversation

@jahorton
Copy link
Copy Markdown
Contributor

@jahorton jahorton commented Oct 23, 2023

In order to provide visual feedback for ongoing gestures, this PR adds a "gesture preview host" - an element that may be overlaid upon a base key (for tablets) or hosted within the keytip (for phones) in order to provide visual feedback about available & ongoing gestures.

The merged styling does have a mild side effect for tablet layouts. In my experience, the selected key's key-cap tends to move slightly up and left compared to its original position while highlighted. Personally... it actually feels kinda nice. I have looked somewhat into why it's happening and how to resolve it, but there's no obvious straightforward answer due to the differences in styling; it's not worth the effort at this stage of prototyping.

For both cases, during a flick, the preview area will scroll corresponding to the flick motion, bringing any 'destination' flick key-caps into view.

Known possible pain-point

If a flick is started during a modipress, but the modipress key is released before the flick is completed, the current settings will auto-terminate the flick. If we'd prefer, I can enable a 'sustain' mode for it that would allow the modipress-layer flick to complete instead, similar to what's already in place for longpress-key selection. This would not be subject to any sort of time-limit, though - that would likely take extra work.

User Testing

TEST_FLICKS_BASIC: Using the standard "Test unminified KeymanWeb" test page from a mobile device...

  1. Select "English...", then "Gesture Prototyping".
  2. Tap and hold the u key.
  3. Drag it in an northwest direction (up and to the left) for at least a key-width.
  4. Release it.
  5. Expected result: ù
  6. Tap the u key again and drag it in a northeast direction for at least a key-width before releasing it.
  7. Expected result: ú (does not replace the previous output)
  8. Tap u again and drag north (straight up) in the same manner.
  9. Expected result: û.

TEST_FLICK_CORRECTION: Using the standard "Test unminified KeymanWeb" test page from a mobile device...

  1. Select "English...", then "Gesture Prototyping".
  2. Tap and hold the u key.
  3. Drag it in an purely west direction (straight left).
  4. Release it.
  5. Expected result: ù
  6. Tap and hold the u key.
  7. Drag it purely south (straight down).
  8. Release it.
  9. Expected result: no output.
  10. Tap and hold the u key again.
  11. Drag it up just a few pixels / millimeters - a very short distance - then release it.
  12. Expected output: u.

TEST_FLICK_ANIMATION: Using the standard "Test unminified KeymanWeb" test page from a mobile device...

  1. Select "English...", then "Gesture Prototyping".
  2. Tap and hold the u key.
  3. For the following steps, pay attention to the animated preview.
  4. Drag it purely north (straight up) - you should see the û key in the preview area (assuming it's not blocked by your finger).
    • If the animation was "jumpy" - if there was a lack of motion at the same time you moved your finger, then a big "jump" to catch up - FAIL this test.
    • If any such "jumps" were directly tied to you moving your finger quickly, do not fail this test.
  5. Drag your finger in a big clockwise motion - you should also see previews for ú, and eventually ù, as you do so.
    • Again, if the animation felt "jumpy" and not well connected to your input, FAIL this test.
  6. While the ù is visible, lift your finger and end the gesture.
  7. Verify that a ù is output.
  8. Repeat steps 2 through 6 for the a key; you should see similar previews and text there. (à, â, á)

TEST_FLICK_DURING_MODIPRESS: Using the standard "Test unminified KeymanWeb" test page from a mobile device...

  1. Select "English...", then "Gesture Prototyping".
  2. Tap and hold the SHIFT key, keeping it stationary for all following steps.
  3. Tap and hold the U key.
  4. For the following steps, pay attention to the animated preview.
  5. Drag it purely north (straight up) - you should see the Û key in the preview area (assuming it's not blocked by your finger).
    • If the animation was "jumpy" - if there was a lack of motion at the same time you moved your finger, then a big "jump" to catch up - FAIL this test.
    • If any such "jumps" were directly tied to you moving your finger quickly, do not fail this test.
  6. Drag your finger in a big clockwise motion - you should also see previews for Ú, and eventually Ù, as you do so.
    • Again, if the animation felt "jumpy" and not well connected to your input, FAIL this test.
  7. While the Ù is visible, lift your finger and end the flick gesture.
  8. Verify that a Ù is output.
  9. Release the SHIFT key (held since step 2).
  10. Verify that the keyboard returns to the default (lowercase) layer.

Testing Resources

https://jahorton.github.io/#for-gesture-testing.

I have put up KMPs for the three gesture-testing keyboards I've developed for this feature branch at the link above. Be sure to check underneath the "For Gesture Testing" header.

@jahorton jahorton requested a review from mcdurdin as a code owner October 23, 2023 03:36
@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Oct 23, 2023

User Test Results

Test specification and instructions

  • TEST_FLICKS_BASIC (PASSED): Tested this PR with the Android Mobile device (Samsung Galaxy A23 5g) and here is my observation: 1 Opened Test unminified KeymanWeb testpage. 2. Set the keyboard to 'English - Gesture Prototyping'. 3. Tapped and hold the 'u' key. Dragged it to 'up and to the left' most direction, then released it. Verified that the expected results ù appear on the screen. 4. Tapped the 'u' key again then dragged it to 'up and to the right' most direction, then released it. Verified that the 'ú' appeared on the text box and it did not replace the previous output) 5. Tapped the 'u' key again and dragged it straight up. Verified that û appears on the text box. Seems to be working as expected. (notes)
  • TEST_FLICK_CORRECTION (PASSED): 1. In the English - Gesture Prototyping keyboard, tapped and hold the 'u' key. Dragged it to straight left direction. Then, release it. Verified that ù appear on the text box. 2. Tapped and hold the u key, dragged it to straight down direction. Released the key. 3. Verified that no output appears on the text input screen. 4. Tapped and hold the u key again. Dragged it up just a few pixels then released it. 5. Verified that 'u' appears on the text box. (notes)
  • TEST_FLICK_ANIMATION (PASSED): 1. In the English - Gesture Prototyping keyboard, tapped and hold the 'u' key. Dragged it to straight-up direction and I was able to see û letter in the preview area without any jumpy. 2. Dragged it in a clockwise motion, I was able to see the previews for ú and ù. 3. Lift my finger when the ù letter is visible. Verified tha ù appears on the text box. 4. Tried the same steps for the letter 'a' and I was able to see similar previews à, â, á on the text box. (notes)
  • TEST_FLICK_DURING_MODIPRESS (PASSED): Retested as per Josh's suggestion in the Android (ver 13) mobile device and here is my observation: 1. Installed Keyman 17.0.200-alpha-test-9825 in the device. 2. Download and install 'gesture_prototyping.kmp' from the https://jahorton.github.io/#for-gesture-testing link. 3. Set "English - Gesture Prototyping" keyboard. 4. Tapped and hold the SHIFT key. Tapped and hold the U key. Dragged it purely straight upward and could able to see Û in the preview area. 5. Dragged my finger in a big clockwise direction and was able to see the previews for Ú and eventually Ù. 6. Lifting my finger after Ù was visible. Verified that a Ù is output in the text screen. 7. Released the SHIFT key. (notes)

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot bot changed the title feat(web): previewing gestures - common phone, tablet styling feat(web): previewing gestures - common phone, tablet styling 🐵 Oct 23, 2023
@keymanapp-test-bot keymanapp-test-bot bot added this to the A17S24 milestone Oct 23, 2023
@jahorton jahorton marked this pull request as draft October 23, 2023 03:38
@mcdurdin mcdurdin modified the milestones: A17S24, A17S25 Oct 27, 2023
@jahorton jahorton force-pushed the feat/web/gesture-preview-host branch from 3811f18 to 1715463 Compare October 31, 2023 07:17
@jahorton jahorton changed the base branch from fix/web/state-change-source-rewrite to feat/web/flick-implementation October 31, 2023 07:17
Comment on lines +182 to +184
if(vkbd.isEmbedded) {
safeBounds = new PaddedZoneSource(safeBounds, [topPadding * topScalar, 0, 0]);
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just caught this as an issue in testing - going off the top of the iOS or Android keyboard was terminating subkeys and flicks almost immediately. There will now be much more room before such a thing kicks in.

If we do want that to be fully, 100% disabled... using NaNs on line 183 can do the trick.

@jahorton
Copy link
Copy Markdown
Contributor Author

jahorton commented Nov 2, 2023

Possibly of note: from the filesize profiling system that's been established...

   ├ ../../../build/engine/osk/obj/input/gestures/specsForLayout.js ──────────────────────────────────────── 9.6kb ─── 2.0%
   │  └ ../../../build/engine/osk/obj/visualKeyboard.js
   │     └ ../../../build/engine/osk/obj/index.js
   │        └ ../../../build/app/browser/obj/keymanEngine.js
   │           └ ../../../build/app/browser/obj/release-main.js

The property names used to spec the gesture-model objects aren't exactly abbreviated like they are for keyboards, and there probably are parts I was a bit WET about. Gotta get the gestures correct first before optimizing their definitions, I suppose. But, should the growth in filesize be a concern, this aspect may be a valuable spot to look. There's also some definite overlap between the 'plain multitap' and 'modipress that can turn into multitap' definitions, for example.

For comparison:

   ├ ../../../build/engine/osk/obj/input/gestures/browser/flick.js ───────────────────────────────────────── 2.4kb ─── 0.5%
   │  └ ../../../build/engine/osk/obj/visualKeyboard.js
   │     └ ../../../build/engine/osk/obj/index.js
   │        └ ../../../build/app/browser/obj/keymanEngine.js
   │           └ ../../../build/app/browser/obj/release-main.js
   ├ ../../../build/engine/osk/obj/input/gestures/browser/multitap.js ────────────────────────────────────── 2.2kb ─── 0.5%
   │  └ ../../../build/engine/osk/obj/visualKeyboard.js
   │     └ ../../../build/engine/osk/obj/index.js
   │        └ ../../../build/app/browser/obj/keymanEngine.js
   │           └ ../../../build/app/browser/obj/release-main.js

Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +88 to +101
// const hintLabel = this.hintLabel = document.createElement('div');
// hintLabel.className='kmw-key-popup-icon';
// hintLabel.textContent = keySpec == keySpec.hintSrc ? keySpec.hint : keySpec.hintSrc?.text;
// hintLabel.style.fontWeight= hintLabel.textContent == '\u2022' ? 'bold' : '';

// // Default positioning puts it far too close to the flick-preview bit.
// let yAdjustment = 0;
// hintLabel.style.marginTop = `-${yAdjustment}px`;

// // b/c multitap's border forces position shifting
// let xAdjustment = 0;
// hintLabel.style.marginRight = `-${xAdjustment}px`;

// base.appendChild(hintLabel);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented code here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I kept it around for possible use for multitap previews, should we have the time & space for that. Might have to triage it out and make an issue with reference to this block as a future 'feature request' instead, though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in #9998 along with some of the cleanup requested for #9909.

@bharanidharanj
Copy link
Copy Markdown

Test Results

  • TEST_FLICKS_BASIC (PASSED): Tested this PR with the Android Mobile device (Samsung Galaxy A23 5g) and here is my observation: 1 Opened Test unminified KeymanWeb testpage. 2. Set the keyboard to 'English - Gesture Prototyping'. 3. Tapped and hold the 'u' key. Dragged it to 'up and to the left' most direction, then released it. Verified that the expected results ù appear on the screen. 4. Tapped the 'u' key again then dragged it to 'up and to the right' most direction, then released it. Verified that the 'ú' appeared on the text box and it did not replace the previous output) 5. Tapped the 'u' key again and dragged it straight up. Verified that û appears on the text box. Seems to be working as expected.

  • TEST_FLICK_CORRECTION (PASSED): 1. In the English - Gesture Prototyping keyboard, tapped and hold the 'u' key. Dragged it to straight left direction. Then, release it. Verified that ù appear on the text box. 2. Tapped and hold the u key, dragged it to straight down direction. Released the key. 3. Verified that no output appears on the text input screen. 4. Tapped and hold the u key again. Dragged it up just a few pixels then released it. 5. Verified that 'u' appears on the text box.

  • TEST_FLICK_ANIMATION (PASSED): 1. In the English - Gesture Prototyping keyboard, tapped and hold the 'u' key. Dragged it to straight-up direction and I was able to see û letter in the preview area without any jumpy. 2. Dragged it in a clockwise motion, I was able to see the previews for ú and ù. 3. Lift my finger when the ù letter is visible. Verified tha ù appears on the text box. 4. Tried the same steps for the letter 'a' and I was able to see similar previews à, â, á on the text box.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Nov 3, 2023
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-required User tests have not been completed label Nov 6, 2023
@bharanidharanj
Copy link
Copy Markdown

Test Results

  • TEST_FLICK_DURING_MODIPRESS (PASSED): Retested as per Josh's suggestion in the Android (ver 13) mobile device and here is my observation: 1. Installed Keyman 17.0.200-alpha-test-9825 in the device. 2. Download and install 'gesture_prototyping.kmp' from the https://jahorton.github.io/#for-gesture-testing link. 3. Set "English - Gesture Prototyping" keyboard. 4. Tapped and hold the SHIFT key. Tapped and hold the U key. Dragged it purely straight upward and could able to see Û in the preview area. 5. Dragged my finger in a big clockwise direction and was able to see the previews for Ú and eventually Ù. 6. Lifting my finger after Ù was visible. Verified that a Ù is output in the text screen. 7. Released the SHIFT key.
    Verified that the keyboard returns to the default (lowercase) layer. It seems to be working as expected.

..Keyman Version

..Able to see the expected output on the screen

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Nov 10, 2023
@mcdurdin mcdurdin modified the milestones: A17S25, A17S26 Nov 13, 2023
Base automatically changed from feat/web/flick-implementation to feature-gestures November 14, 2023 08:26
@jahorton jahorton merged commit 1a7245e into feature-gestures Nov 14, 2023
@jahorton jahorton deleted the feat/web/gesture-preview-host branch November 14, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants