Commit graph

677 commits

Author SHA1 Message Date
Marc Durdin
e98930dedb
Merge branch 'master' into fix/web/5779-font-scaling-in-osk 2021-11-29 09:12:15 +11:00
Marc Durdin
45821fcb1b fix(web): adjust tablet font scaling
This makes two corrections:

1. Removed an obsolete test for screen size based on dpi, which is
   unreliable, meant that we had been treating many Android tablets as
   phones (domManager.ts).
2. Font scale for Android tablets had some incorrect assumptions around
   keyboard height and devicePixelRatio, which I was able to simplify
   into a fixed ratio, and was much better across all devices I
   tested (however, all emulated in Chrome).
2021-11-29 08:56:41 +11:00
Marc Durdin
8bc61094c8
Merge pull request #5958 from keymanapp/fix/web/improve-keyboard-switch-performance
fix(web): improve keyboard switch performance
2021-11-29 06:34:55 +11:00
Marc Durdin
93d2e82096
Merge pull request #5949 from keymanapp/fix/web/5912-popupbasetarget
fix(web): remove obsolete popupBaseTarget
2021-11-29 06:34:49 +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
075a92b903
Merge pull request #5938 from keymanapp/fix/web/5935-inline-osk-keytip-position
fix(web): inline osk keytip position
2021-11-22 15:04:24 +11:00
Marc Durdin
08a83a0366
Merge pull request #5910 from keymanapp/fix/web/5907-simplify-hide-transition
fix(web): simplify hide transition
2021-11-22 15:04:16 +11:00
Marc Durdin
909d833474 fix(web): improve keyboard switch performance
Summary of these changes:

Two targeted improvements; more optimization is possible but IMO this is
a significant enough improvement to go through test:

1. In oskView.ts, avoid calling `VisualKeyboard.refreshLayout` twice
   from `OSKView.refreshLayout`. This roughly halves the time spent in
   `VisualKeyboard.refreshLayout` for a keyboard switch.
2. In modelManager.ts, we avoid a very expensive `unloadModel` /
   `loadModel` sequence from `registerModel` by checking to see if the
   model spec we are passed is already registered. This avoids an
   expensive callback to Keyman for Android which causes the banner to
   'bounce'.

Longer notes:

So `VisualKeyboard.refreshLayout` is called 20+ times during a keyboard
switch. It is a very expensive call. It is the bulk of the time spent
when you press the globe key in Keyman for Android. This seems ripe for
optimization; see the following functions in keyboard.html:

* `setKeymanLanguage` -> `setActiveKeyboard` -> 6 calls
* `enableSuggestions` -> `registerModel` -> 8 calls
* `stateChange` -> 6+ calls

`OSKView.refreshLayout` always seems to call
`VisualKeyboard.refreshLayout` twice: first with `setSize`, and then
again itself.

Keyman for Android and KeymanWeb seem to fight over who is responsible
for selecting models (KMW first calls `loadModel`, then Keyman for
Android calls `unloadModel`, `loadModel`, through `enableSuggestions`).

The fix for rotation (`correctOSKTextSize()`), as called from
`stateChange()`, is expensive as well, because it rebuilds the entire
keyboard from scratch.

Along with that, we have the size of the webview changing as the model
is unloaded and reloaded and lots of back-and-forth between the
KeymanWeb and KMEA which seems unnecessary.

Shouldn't KeymanWeb be responsible for loading and unloading models,
once they are all registered? We should only need to register the models
once at page load time (when config changes, do we just reload the
page?).
2021-11-22 10:47:05 +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
95dcbc3e57 fix(web): remove obsolete popupBaseTarget
Fixes #5912.

The variable `popupBaseTarget` is never set. Removing.
2021-11-19 13:53:56 +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
3b948a5254 fix(web): simplify hide transition
Fixes #5907.

The state machine for the Hide transition for the OSK was very complex,
and had some peculiarities which caused it to sometimes fail to
correctly hide. Once I simplified the state machine, it seems that those
edge cases have gone away, and the keyboard always hides correctly.

There is an unrelated issue with focus timeout which can be confusing
when testing this; see #5909.
2021-11-15 16:09:14 +11:00
Marc Durdin
9da4ffa77a fix(web): font size was not consistently set
Fixes #5779.
Fixes #5731 (I believe mitigation is sufficient to close this issue).

A variety of interrelated font and font size display issues resolved:
1. KVK font was not applied early enough for size calculations, which
   meant that we were calculating font scaling per key based on a
   default font when transforming from the KVK data for desktop devices
   (defaultLayout.ts)
2. Font scaling for non-default layers was calculated when elements were
   not visible and had no size information, giving incorrect values. To
   resolve this, font scaling is now calculated when a layer is made
   visible, which had performance impacts; resolved by reducing
   unnecessary `layer.refreshLayout()` calls; see performance point 1
   below (oskView.ts:layerChangeHandler())
3. `getViewportScale()` would return an incorrect scaled value when
   emulating touch devices on a desktop browser (kmwutils.ts)
4. After switching keyboards, the device-specific scaling factor was not
   maintained (oskView.ts:refreshLayout())

Related performance improvements:
1. Multiple calls to `layer.refreshLayout()` in `refreshLayout()` have
   been eliminated, and only the currently visible layer is now
   refreshed. This dramatically reduces the number of calls to
   `getIdealFontSize()` which was the primary concern of #5731.
   (visualKeyboards.ts)
2. Unnecessary use of `innerHTML` replaced with `innerText`
   (oskBaseKey.ts)

Minor Keyman Developer performance improvement:
1. The web debugger no longer recalculates the OSK twice (test.js)
2021-11-15 10:08:18 +11:00
Marc Durdin
66be206d96 feat(developer): support for U_xxxx_yyyy 2021-11-11 13:08:39 +11:00
Marc Durdin
dbd9787a7a
Merge branch 'master' into fix/web/popup-positioning 2021-10-05 17:41:49 +11:00
Marc Durdin
0cf4a3c512
Merge pull request #5723 from keymanapp/feat/developer/touch-layout-testing
feat(developer): touch layout testing 🎩
2021-10-05 17:40:26 +11:00
Joshua Horton
c008d16654
Merge pull request #5739 from keymanapp/feat/web/mouse-based-banner
feat(web): enables mouse interactivity for the predictive banner 🧵
2021-09-23 10:57:13 +07:00
jahorton
31ac1b7c1b chore(web): replaces literals with constants 2021-09-23 09:27:09 +07:00
jahorton
3363963f11 docs(web): addresses comment-style per review 2021-09-23 09:16:34 +07:00
jahorton
ddccb64d96 docs(web): removes old, unused (commented) code 2021-09-23 08:10:28 +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
f53df318dc feat(web): functional banner mouse interactions 2021-09-22 12:37:33 +07:00
jahorton
26d00d6c9f refactor(web): second inputEventEngine pass - new config obj 2021-09-22 12:37:32 +07:00
jahorton
be98d8718a fix(web): banner's touch-move when not embedded 2021-09-22 12:37:32 +07:00
jahorton
e87a277be8 refactor(web): first pass generalization for inputEventEngine 2021-09-22 12:37:31 +07:00
jahorton
595984c813 fix(web): desktop sil_euro_latin patchup 2021-09-22 09:20:09 +07:00
jahorton
14c2c08954 change(web): key use of innerText over innerHTML 2021-09-22 08:54:52 +07:00
jahorton
202377e79b fix(web): should not use _Box.style.maxWidth 2021-09-22 08:52:19 +07:00
Darcy Wong
6240d305b4 fix(web): Check keyboard before marking layout calibrated 2021-09-22 11:02:53 +10:00
jahorton
354e852130 feat(web): inlined OSK - target device hotswap 2021-09-21 14:04:10 +07:00
jahorton
c7ba56c23a feat(web): input alignment on layout refresh 2021-09-21 13:44:29 +07:00
jahorton
0640b60e3e chore(web): Merge branch 'refactor/web/osk-activation-and-visibility' into feat/web/inlined-osk 2021-09-21 12:51:29 +07:00
jahorton
ebd673fdb2 fix(web): osk dismissal after focus timer 2021-09-21 12:19:11 +07:00
jahorton
0956fb62a7 docs(web): adds comment about prior commit's fix 2021-09-20 15:48:18 +07:00
jahorton
da8e83090a fix(web): touch-based unit test issues 2021-09-20 15:46:59 +07:00
jahorton
48fe02023c fix(web): fixes unit test issue (event's 'buttons' property) 2021-09-20 14:39:27 +07:00
jahorton
f7dc8e1140 chore(web): Merge branch 'refactor/web/osk-activation-and-visibility' into feat/web/inlined-osk 2021-09-17 15:26:03 +07:00
jahorton
3f48ae7e99 fix(web): more polish, fixes pinned position management 2021-09-17 15:15:53 +07:00
jahorton
09de360789 fix(web): missed bits of last commit, adds some polish 2021-09-17 15:02:43 +07:00
jahorton
8826bec8fe fix(web): incorporates some review suggestions 2021-09-17 14:58:18 +07:00
jahorton
ffc381fcb6 chore(web): Merge branch 'refactor/web/active-element-integrations' into refactor/web/osk-activation-and-visibility 2021-09-17 08:38:49 +07:00
jahorton
f95f732297 chore(web): Merge branch 'refactor/web/specialized-osk-views' into refactor/web/active-element-integrations 2021-09-16 14:52:45 +07:00
jahorton
c15fe2015e chore(web): Merge branch 'refactor/web/osk-view-abstraction' into refactor/web/specialized-osk-views 2021-09-16 10:03:19 +07:00
jahorton
ae0786a109 chore(web): Merge branch 'master' into refactor/web/osk-view-abstraction 2021-09-16 09:57:15 +07:00
Joshua Horton
f2e07e8add
Merge pull request #5619 from keymanapp/refactor/web/osk-view-components
refactor(web): OSK modularization - view components, layout cleanup ✂️
2021-09-16 09:56:08 +07:00
jahorton
d429c76a52 fix(web): spacebar caption when functional layer differs from display layer 2021-09-14 15:34:27 +07:00
jahorton
e2c2084380 chore(web): adds default value for optional chain 2021-09-14 13:10:52 +07:00
jahorton
11ee389a24 chore(web): copyright tweak 2021-09-14 13:08:46 +07:00