Commit graph

55 commits

Author SHA1 Message Date
Marc Durdin
295f25144d
Merge pull request #6383 from keymanapp/fix/web/5929-ios-popup-positioning-and-style
fix(web): ios popup positioning and style
2022-03-28 04:46:00 +11:00
Marc Durdin
b3ddf633df fix(web): adjust calc for callout height 2022-03-25 09:10:29 +11:00
Marc Durdin
3858a4c9e5 fix(web): further iOS adjustments 2022-03-24 07:35:28 +11:00
Marc Durdin
adf3fe28c9 fix(web): tweak iOS key preview and longpress dimensions
Adjusts the dimensions to use pixel boundaries to prevent antialiasing
for some of the key preview and longpress popups, and adjusts horizontal
positioning of key preview to center more precisely, for iOS.
2022-03-23 08:23:29 +11:00
Marc Durdin
558a742a45 fix(web): adjust callout height 2022-03-22 10:02:36 +11:00
Marc Durdin
dde56e6b90 fix(web): adjust positioning for longpress popup
Adjusts positioning calculations for longpress popups and corresponding
styles to make it consistent across all platforms, particularly iOS.
2022-03-17 10:20:19 +11:00
Marc Durdin
86b4b82661 fix(web): key preview position was inconsistent on iOS
Adjusts calculations for key preview and ensures we use box-sizing:
content-box in all circumstances, to make it consistent across all
platforms.
2022-03-17 10:19:10 +11:00
Marc Durdin
a2aef99c3e fix(web): font size on key preview
Font size adjustment needed an override for the key preview to prevent
it using the base key font size as a starting point.
2022-03-17 10:15:40 +11:00
Marc Durdin
d3136b8860 fix(web): ios popup positioning and style
Fixes #5929.
Fixes #6381.

This fixes four separate issues with the longpress popups and key
previews:

1. The key preview was offset by a couple of pixels (unreported issue).
2. The background 'shim' did not cover the key caps, which caused them
   to look startlingly white when the rest of the background greyed
   down (#5929).
3. The popup menu was incorrectly wrapping to two rows due to sizing
   model mismatches (#6381).
4. The popup menu would be realigned incorrectly for the in-app
   keyboard, when moving it to keep it in the keyboard area (#5929).
2022-03-16 11:24:02 +11:00
Marc Durdin
f355722191 fix(web): back out caps lock and refix
The Caps Lock change I made in the previous commit broke
desktop Caps Lock handling. The fix was a little more
convoluted. Turns out that _UpdateVKShift is also pretty
crufty. I simplified it, removing dead code.
2022-03-10 13:31:06 +11:00
Marc Durdin
5fbb1c1dfb chore(web): minor cleanup of pending longpress 2021-12-01 09:27:25 +11:00
Marc Durdin
62796e3489 feat(web): Caps Layer and double-tap gesture
Fixes #3620.

Implements the Caps Lock layer support and the double-tap gesture on the
shift key to access it.

The double-tap gesture has been implemented with a view to extension to
support other multi-tap gestures in the future. However, for now, it is
limited to supporting the Shift key, if and only if the keyboard
includes a Caps layer.

The reason for this v15 limitation is that multi-tap on regular keys
would involve either rewinding the previous keystroke (the first tap),
or forcing keyboard developers to consider 'rota' style rules in their
keyboards to support the multi-tap gestures, as we need to make sure
that the first tap is accepted and processed for immediate feedback.
This needs more design, to avoid unnecessary complexity in the keyboards
and/or the rewinding of the keystroke (even though that is conceptually
supported in Keyman Engine for Web already). Basically, we don't want to
constrain the way that a keyboard author may use the multi-tap gesture
by hard-coding the rewind, but neither do we want to make all multi-tap
gestures needlessly complex to author.

The shift key (and other modifiers, potentially in future) needs special
support for multi-tap as the key that is being tapped changes with the
layer change. This is currently managed through recognising `K_SHIFT` in
the key id.

I have tried to follow the `PendingGesture` pattern for multi-tap, and
the gesture itself supports a series of taps, not just a double-tap. The
maximum time to complete the tap series is 125msec * number-of-taps, so
for a double-tap is 250msec.

The changes to support a Caps Lock layer itself were minimal; just
adding the `text.KeyboardProcessor.getStateFromLayer` function and
calling it during `KeyEvent` construction. The remaining changes relate
to the multi-tap gesture.

Minor changes:
* I moved `constructNullKeyEvent` to `KeyEvent` in order to make it
  more accessible to other classes.
* The multi-tap gesture does not have a promise to complete, so that is
  now an optional member of the `PendingGesture` interface.
2021-12-01 08:59:43 +11:00
Marc Durdin
9eb2e4d4f9
Merge pull request #5952 from keymanapp/fix/web/5950-clear-timeout-on-longpress-flick
fix(web): clear longpress timeout if user does a flick up
2021-11-24 18:04:33 +11:00
Marc Durdin
10a41c43cc fix(web): clear longpress timeout if user does a flick up
Fixes #5950.

If a user starts a longpress gesture and then flicks up, that
immediately brings up the longpress menu, and the timeout for display of
the menu should be cancelled -- otherwise the end result is a key that
stays 'stuck' on.
2021-11-19 15:43:27 +11:00
Marc Durdin
0314593a96 fix(web): inline osk keytip position
Fixes #5935.

Takes parent element's position into account when calculating keytip
location.
2021-11-18 15:47:56 +11:00
Marc Durdin
35c5a34126
Update web/source/osk/browser/keytip.ts 2021-11-17 09:14:21 +11:00
Marc Durdin
c9474ceae8 fix(web): remove canvas use for iOS compatibility
Fixes #5831.

iOS 15 has a significant crashing bug whereby use of a canvas element
completely crashes the browser in some contexts. In particular, we have
observed this when using a WKWebView in a keyboard extension without
'Allow Full Access' switched on.

Keyman uses canvas element to draw a nice looking key preview (key tip)
on iPhones. This is a critical issue for Keyman for iPhone. Keyman for
iPad is not affected because the iPad version does not use key previews.

The resolution here is to remove use of the canvas drawing for key tips
and use a simplified pure HTML/CSS shape. I have not conditioned this
fix on platform; I have currently opted to apply this to all platforms.

This issue will be reported to Apple for resolution. The issue applies
so far to iOS 15.0, 15.1.
2021-11-16 16:51:34 +11:00
Marc Durdin
dbd9787a7a
Merge branch 'master' into fix/web/popup-positioning 2021-10-05 17:41:49 +11:00
jahorton
31ac1b7c1b chore(web): replaces literals with constants 2021-09-23 09:27:09 +07:00
Marc Durdin
c760fb7464 fix(web): popup positioning
Fixes three issues:

* longpress positioning for inlined OSK views where not all elements
  may be in the offset hierarchy; impacts particularly where an inlined
  OSK may be within a flex-box.

* Tweaks position of keytip, to take into account the offsetTop of the
  key element.

* Inverts test for display of longpress callout, matching Keyman 14.
2021-09-23 08:18:57 +10:00
jahorton
da8e83090a fix(web): touch-based unit test issues 2021-09-20 15:46:59 +07:00
jahorton
632642b6c2 feat(web): functional touch-subkeys on desktop 2021-09-02 12:30:37 +07:00
jahorton
dfdf0c2e9b fix(web): key preview positioning 2021-09-02 10:39:54 +07:00
jahorton
6b248075d6 feat(web): partially-functional inlined OSK! 2021-09-01 15:31:01 +07:00
jahorton
9611537e06 refactor(web): osk._Load 2021-08-23 10:01:07 +07:00
jahorton
e1da0014c3 refactor(web): start of OSKView abstraction 2021-08-23 10:01:06 +07:00
jahorton
a96d04cc4e refactor(web): abstraction for OSK touch-event input 2021-07-30 08:15:15 +07:00
jahorton
84e2c368cf fix(web): restores key tip, subkey popup positioning 2021-07-27 07:56:54 +07:00
jahorton
3f2897485b refactor(web): drops 'widthpc', 'padpc' 2021-07-26 15:59:25 +07:00
jahorton
e90eb643f5 refactor(web): kmw-5rows class: key -> layer 2021-07-26 15:19:23 +07:00
jahorton
43d5181092 change(web): more consistent base-key longpress release 2021-07-06 14:27:37 +07:00
jahorton
fefffc80fd fix(web): more consistent clear on base key highlights 2021-07-06 14:14:14 +07:00
jahorton
543812c0d7 fix(web): missing 'bind' for in-browser resolve 2021-07-02 09:25:29 +07:00
jahorton
b775618937 fix(web): embedded ios stuck base key highlights 2021-07-02 09:09:58 +07:00
jahorton
8d0364016f fix(web): missed a '!' for in-browser base key reselection 2021-07-01 08:11:43 +07:00
jahorton
c6a5961421 feat(web): adds error log to SubkeyPopup.updateTouch 2021-06-30 12:16:15 +07:00
jahorton
cafe421e98 docs(web): gesture subclasses 2021-06-30 12:09:19 +07:00
jahorton
a8e82e5bea chore(web): more changes from PR review 2021-06-30 11:09:32 +07:00
Joshua Horton
e0cf57d508
chore(web): Apply suggestions from code review
Co-authored-by: Marc Durdin <marc@durdin.net>
2021-06-30 10:11:46 +07:00
jahorton
625b5fd8c8 fix(web): output base key if subkey touch returns to it (in-browser) 2021-06-24 12:54:10 +07:00
jahorton
60081b7c4a refactor(web): initial mutual abstraction for pending longpresses 2021-06-24 12:34:43 +07:00
jahorton
d5e5635242 refactor(web): merged subkey highlighting control 2021-06-24 12:34:43 +07:00
jahorton
0d109b12b0 refactor(web): 'easy' part of abstracted RealizedGesture for subkeys 2021-06-24 12:34:43 +07:00
jahorton
3a98204919 fix(web): pending-longpress field management 2021-06-24 12:33:42 +07:00
jahorton
36536f89bc refactor(web): browser subkey control flow abstraction prep 2021-06-24 12:33:42 +07:00
jahorton
d4d9808727 refactor(web): in-browser subkey tracking managed by SubkeyPopup 2021-06-24 12:12:08 +07:00
jahorton
8794f7d018 change(web): allows passive cancel for subkey promises 2021-06-17 09:37:34 +07:00
jahorton
e347c423bf refactor(web): wraps in-browser subkey selection with Promise 2021-06-16 15:17:06 +07:00
jahorton
4c5500d026 refactor(web): osk key highlighting 2021-06-16 09:20:43 +07:00
jahorton
0566f435d9 refactor(web): osk key class defs -> separate files 2021-06-16 08:39:53 +07:00