Commit graph

1939 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
Darcy Wong
19f1d4f5a7 chore(android): Merge remote-tracking branch 'origin/beta' into fix/android/subkey-move 2022-03-23 13:05:25 +07:00
Marc Durdin
5c388d1d7e
Merge pull request #6366 from keymanapp/feat/web/6364-new-layer-old-layer-replaces-layerchanged
feat(web): `&newLayer` and `&oldLayer`
2022-03-23 16:53:34 +11:00
Marc Durdin
336ab51010
Merge pull request #6406 from keymanapp/fix/web/5942-touch-alias-element-position
fix(web): adjust touch alias element positioning
2022-03-23 11:27:35 +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
6b1ae79c11 fix(ios): remove busy 100ms waitForFonts timer on iOS
Observed while debugging another issue on iOS. The
VisualKeyboard.waitForFonts function sets up a busy timer to wait for
font loading. This functionality is not even needed on the iOS app,
because it's really only used for the touch alias elements.

However, it was being called, potentially multiple times, leading to the
timer never being removed. On Android, the timer was correctly removed.

This aligns the iOS code path with the Android code path.
2022-03-22 09:21:17 +11:00
Marc Durdin
88ffb8bbd2 fix(web): adjust touch alias element positioning
Fixes #5942.

The touch alias element position was not consistent across all browsers,
leading to misalignment in some situations. Identified missing CSS to
make the positioning consistent, as far as I can tell, which led to the
additional benefit of reducing the per-browser special cases.
2022-03-22 08:38:12 +11:00
Marc Durdin
767d278f87
Merge pull request #6357 from keymanapp/fix/web/bounding-rect-offset
fix(web): bounding rect offset was incorrect
2022-03-19 13:13:19 +11:00
Marc Durdin
e3537e7bb7 fix(web): crash on focus before init
Fixes the following crash noted when testing on keymanweb.com, focusing
during the load process on a slow network.

```
helpers.ts:111 Uncaught TypeError: Cannot read properties of null (reading 'vkbd')
    at g.pageFocusHandler (keymanweb.ts:125:44)
    at sentryWrapped (helpers.ts:87:17)
```
2022-03-17 15:50:52 +11:00
Darcy Wong
70ec9b7096 fix(web): Don't update base key if popups displayed 2022-03-17 10:58:48 +07: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
24398b4461 fix(web): key square needed vertical align top
On Safari, some keys were vertically misaligned, due to different
default vertical-align.
2022-03-17 10:17:23 +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
7a5d1b964f chore(web): Merge branch 'beta' into feat/web/6364-new-layer-old-layer-replaces-layerchanged 2022-03-17 04:55:25 +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
1038379c41
Merge pull request #6351 from keymanapp/fix/web/caps-state-tracking-for-touch
fix(web): caps state tracking for touch
2022-03-15 10:04:45 +11:00
Marc Durdin
4b15c4988e
Merge pull request #6340 from keymanapp/fix/web/5964-subkey-position-on-scroll-non-zero
fix(web): subkey touch position after scroll
2022-03-15 10:02:07 +11:00
Marc Durdin
45c5f8a1ea chore(web): remove 0 from store defaults 2022-03-13 08:31:15 +11:00
Marc Durdin
b23df3fbc8 feat(web): &newLayer and &oldLayer
Fixes #6364.

Removes `&layerChanged` and adds `&newLayer` and `&oldLayer` system
stores with the additional nuances around values as described in #6364.
2022-03-13 08:29:15 +11:00
Marc Durdin
ada527bd80 fix(web): bounding rect offset was incorrect
When embedding the On Screen Keyboard into a page, the calculation for
the bounding rectangle only took into account the first offsetParent,
which meant it would get the offset incorrect when there were multiple
layers of offsetParents.

Once I changed to using getAbsoluteX / getAbsoluteY, this also corrects
for scroll with window.pageOffsetY, so we can eliminate that special
case for fixed positioning.

This was observable in the Web Developer test window, where interaction
with the bottom row of the keyboard in touch mode was not working
correctly, in 15.0.210-beta.
2022-03-11 04:34:36 +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
6e1e7e8e7e chore: additional scripts 2022-03-10 10:26:15 +11:00
Marc Durdin
272c1f0d1c fix(web): subkey touch position after scroll
Fixes #5964.

It seems that the test for subkey position was incorrect when the
document had been scrolled. Removing the test for `fixed` positioning
resolves the issue.
2022-03-08 17:27:16 +11:00
Marc Durdin
f633174f9f fix(web): stop masking error
We are seeing this error thrown in some logs but it masks the underlying error.
2022-03-04 11:44:54 +11:00
Marc Durdin
aeeffc3568
Merge pull request #6310 from keymanapp/fix/web/6072-stop-css-repeated-injection
fix(web): stop repeated CSS injection ✂
2022-03-02 12:50:16 +11:00
Marc Durdin
b5615e3a4b fix(web): error in floating osk view when no keyboard active
This fixes an issue that arises when loading the Keyman Developer Server
home page and there are registered keyboards, but no keyboards active.
The floating osk view would throw an exception because it would attempt
to set the title of the view from the active keyboard, which is `null`.
2022-03-02 08:46:10 +11:00
Marc Durdin
6734d824a5 fix(web): stop repeated CSS injection 2022-03-02 06:37:51 +11:00
Marc Durdin
b05fda1c6a fix(web): selection direction and tests
Selection direction was not maintained in mutations, which could have
unexpected consequences. Added support for selection direction to input
and textarea.

The functions `getTextBeforeCaret()` and `getTextAfterCaret()` are named
somewhat incorrectly, as they actually get the text before and after the
active selection (and a collapsed zero-length selection is equivalent to
the caret). It would be worth renaming these in a future refactor.

This PR fixes the unit tests so that caret position is tested correctly
with an active selection -- the caret can be at either the start or the
end of the selection, corresponding with the direction in which the user
originally selected the text. It also fixes the assumptions around the
above named functions for `input` and `textarea` types.

Note that selection interactions are still buggy with prediction
selections; these bugs were present in 15.0.118-alpha and I will tackle
them in an upcoming commit.
2022-02-23 15:13:07 +11:00
Marc Durdin
cacbbee5cc fix(web): properly handle selection
Relates to #5853 and others.

Selection management was not working properly with the various
OutputTargets:

1. When there is a non-empty selection, rules have no context -- it's
   like new text.
2. Backspace over a selection deletes just the selection.
3. Typing a character replaces the selection, of course, and collapses
   the caret to the end of the new text.
4. `hasSelection` is a very strange name for `OutputTarget` descendants.
   It doesn't mean "has an active selection" but rather, kinda means
   "supports selection internally".
5. Added `isSelectionEmpty` which is used for some of the new selection
   rules above.

Note that the `touchAlias` OutputTarget class does not currently support
selection. I hope we can deprecate `touchAlias` with the use of
`inputMode` (#3030) in the future, rather than adding support for
selection.
2022-02-23 15:12:58 +11:00
Marc Durdin
ac2cc93f2a fix(web): add readonly mode for rule behavior finalization
Relates to #5853.

Two things happened here:

1. Construction of Mocks made an assumption that the selection should
   always be deleted (outputTarget.ts:363). However, for NewContext and
   PostKeystroke processes, we don't want to change anything.

2. Even if nothing is changed, the transcription would emit what is
   in theory a no-op ruleTransform (insert="", deleteLeft=0,
   deleteRight=0). But apps would treat this as deleting the selection.

This fix goes a little broader than I would have preferred, but adds a
readonly mode to the transcription and mock model, so that we can
control explicitly when changes are applied to the text store.
2022-02-22 10:42:20 +11:00
Marc Durdin
da5d00c284 fix(web): Non-integer OSK sizes
If the OSK had a non-integer width or height stored in the OSK cookie,
then the width and height would be parsed incorrectly and the OSK would
fail to be sized correctly on first load; this also caused a script
error and made the OSK impossible to interact with.
2022-02-12 19:06:12 +07:00
Marc Durdin
64d9634b86 fix(web): crash in setTitleFromKeyboard when no keyboard active 2022-01-20 07:54:59 +11:00
Darcy Wong
87c18b2434
Merge pull request #6100 from keymanapp/fix/web/execute-popup-layer
fix(web): Use regex to determine display layer and functional layers
2022-01-18 11:17:21 +07:00
Darcy Wong
f11fab54c2 fix(web): Incorporate review comments
Fix regex and optimize code and remove unused displayLayer
2022-01-17 09:54:50 +07:00
Marc Durdin
44ddf1e9aa
Merge branch 'master' into feat/web/3620-caps-layer 2022-01-17 12:26:32 +11:00
Marc Durdin
1b57c110e2
Merge pull request #6004 from keymanapp/fix/web/3621-call-postkeystroke-on-banner-click
fix(web): call postKeystroke on banner touch 🕊
2022-01-17 12:14:14 +11:00
Marc Durdin
0c0bb420b5
Merge pull request #5963 from keymanapp/feat/web/3621-newcontext-group
feat(web): Start of Sentence support - part 1 🕊
2022-01-17 12:04:29 +11:00
Darcy Wong
77ac5f1122 chore(web): Add some sanity checking 2022-01-13 13:00:40 +07:00
Darcy Wong
1eeb5b1da9 fix(web): Use regex to determine layers 2022-01-12 14:58:35 +07:00
Darcy Wong
5769c80d12 fix(web): Fix layers for embedded longpress keys 2022-01-12 14:58:35 +07:00
Marc Durdin
ce1ce4e428
Update web/source/osk/banner.ts
Co-authored-by: rc-swag <58423624+rc-swag@users.noreply.github.com>
2021-12-07 19:57:29 +11:00
Marc Durdin
10ef52624d chore: remove commented code 2021-12-03 14:15:48 +11:00
Marc Durdin
5e65120b3f fix(web): call postKeystroke on banner touch
Relates to #3621.

Ensures that the `begin postKeystroke` entry point is called when the
user accepts a suggestion.
2021-12-03 14:13:43 +11:00
Marc Durdin
9995c9f54c fix(web): revise tablet detect strategy
This is based on research from various websites, including Google
documentation and https://screensiz.es/, as well as various older pages.
2021-12-02 15:37:56 +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