Commit graph

4628 commits

Author SHA1 Message Date
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
Keyman Build Agent
a5f2892c31 auto: increment master version to 15.0.154 2021-11-20 13:01:25 -05:00
Marc Durdin
90f59a5cda
Merge pull request #5902 from keymanapp/fix/web/5353-uncaught-in-promise-error
fix(web): resolve unhandled exception in promise
2021-11-20 10:57:31 +11:00
Keyman Build Agent
ceadbb0fc5 auto: increment master version to 15.0.153 2021-11-19 13:01:24 -05: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
db7f7e1f4b
Merge branch 'master' into fix/web/5353-uncaught-in-promise-error 2021-11-19 13:11:59 +11:00
Marc Durdin
9162d575ce fix(web): support saving focus for custom OSK interactions
Fixes #5944.

If a custom OSK, such as sil_euro_latin, calls `keymanweb.KSF()` or
`keymanweb.saveFocus()`, this ensures that the next focus change is
ignored, which prevents the OSK from being dismissed as soon as it is
clicked on.

This is a regression, probably arising in version 10.0.

Note: `_SelectionChange` is no longer used or referenced, so I removed
it as part of this fix.
2021-11-19 12:58:53 +11:00
Marc Durdin
cceb2f35b5 fix(web): shorten setFocusTimer()
Fixes #5909.

The `setFocusTimer()` delay was 1000ms. However, it seems that a much
shorter delay accomplishes the same outcome for switching between
controls, as the important factor is to block asynchronously-arriving
events from cancelling the OSK / focus controls for touch alias
elements.

I have set the delay to 50ms. This is fast enough that a click in a
control followed by a click on the page area will always cancel the OSK,
but gives the space needed for queued focus/blur events have time to be
processed before cancelling the timer.
2021-11-19 11:22:21 +11:00
Keyman Build Agent
68328487d2 auto: increment master version to 15.0.152 2021-11-18 13:01:57 -05: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
Keyman Build Agent
b5475dd98a auto: increment master version to 15.0.151 2021-11-17 15:26:49 -05:00
Marc Durdin
8cdf982863
Merge pull request #5915 from keymanapp/fix/web/5831-remove-canvas-for-ios-compat
fix(web): remove canvas use for iOS compatibility
2021-11-18 07:23:49 +11:00
Keyman Build Agent
420789a02d auto: increment master version to 15.0.150 2021-11-17 13:01:40 -05:00
Marc Durdin
c2c7e00e94 fix(web): reset scroll anchor on touchend
Fixes #5313.
2021-11-17 10:37:01 +11:00
Marc Durdin
35c5a34126
Update web/source/osk/browser/keytip.ts 2021-11-17 09:14:21 +11:00
Keyman Build Agent
51117bb93b auto: increment master version to 15.0.149 2021-11-16 13:01:40 -05: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
Keyman Build Agent
e2753c89f1 auto: increment master version to 15.0.148 2021-11-15 13:01:48 -05: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
fc8d1b3e72 fix(web): avoid error if timerid not valid
Relates to #5904.

If a call to api.keyman.com takes longer than 10 seconds, the timerid
would no longer be valid, even if the call returns successfully. This
threw a cascade of errors.

There was a secondary issue where keymanweb.com was passing in an
invalid timerid, causing the same error cascade. This is fixed in
keymanapp/keymanweb.com#38.
2021-11-15 11:17:59 +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
Keyman Build Agent
f6d8133a73 auto: increment master version to 15.0.147 2021-11-14 13:01:30 -05:00
Marc Durdin
a25b9cd8eb
Merge pull request #5894 from keymanapp/feat/developer/2858-u_xxxx_yyyy
feat(developer): support for U_xxxx_yyyy
2021-11-14 15:47:55 +11:00
Marc Durdin
a7c050d71b fix(web): resolve unhandled exception in promise
Fixes #5353.

I made the promise usage consistent in the relevant addKeyboards
functions, instead of mixing promise and async/await style code, which
made it easier to spot the place(s) where promises had not been returned
as we needed.
2021-11-14 15:43:43 +11:00
Keyman Build Agent
85709945bb auto: increment master version to 15.0.146 2021-11-13 13:01:33 -05:00
Keyman Build Agent
a1faff2bc8 auto: increment master version to 15.0.145 2021-11-12 13:01:50 -05:00
Darcy Wong
1c682692e9
Merge pull request #5874 from keymanapp/fix/web/parent-element
fix(web): Check parent element is defined before assigning
2021-11-12 08:52:24 +07:00
Keyman Build Agent
11d53c4aa1 auto: increment master version to 15.0.144 2021-11-11 13:01:21 -05:00
Marc Durdin
66be206d96 feat(developer): support for U_xxxx_yyyy 2021-11-11 13:08:39 +11:00
Keyman Build Agent
5f8a25f55d auto: increment master version to 15.0.143 2021-11-08 13:01:45 -05:00
Keyman Build Agent
503d12ceec auto: increment master version to 15.0.142 2021-11-05 14:02:49 -04:00
Keyman Build Agent
906da08c47 auto: increment master version to 15.0.141 2021-11-03 14:01:32 -04:00
Keyman Build Agent
46a10d8f44 auto: increment master version to 15.0.140 2021-11-02 14:01:20 -04:00
Darcy Wong
9136933c9e fix(web): Check parent element is defined before assigning 2021-11-02 11:22:08 +07:00
Keyman Build Agent
52506b74c6 auto: increment master version to 15.0.139 2021-10-29 14:01:38 -04:00
Keyman Build Agent
cf1ea0e71b auto: increment master version to 15.0.138 2021-10-28 14:01:16 -04:00
Keyman Build Agent
5334c0b71e auto: increment master version to 15.0.137 2021-10-23 14:01:23 -04:00
Keyman Build Agent
ee8bc76d49 auto: increment master version to 15.0.136 2021-10-20 14:01:23 -04:00
Keyman Build Agent
e2dea842e3 auto: increment master version to 15.0.135 2021-10-19 14:01:28 -04:00
Keyman Build Agent
fbbe812765 auto: increment master version to 15.0.134 2021-10-16 14:01:31 -04:00
Keyman Build Agent
c0d395beee auto: increment master version to 15.0.133 2021-10-15 14:01:14 -04:00
Keyman Build Agent
697e377f70 auto: increment master version to 15.0.132 2021-10-13 14:01:16 -04:00
Keyman Build Agent
94d81d07fa auto: increment master version to 15.0.131 2021-10-11 14:01:08 -04:00
Keyman Build Agent
7b512bc97a auto: increment master version to 15.0.130 2021-10-08 14:01:33 -04:00
Keyman Build Agent
0a0751a28b auto: increment master version to 15.0.129 2021-10-06 23:11:38 -04:00
Keyman Build Agent
ad7bd88255 auto: increment master version to 15.0.128 2021-10-06 14:01:19 -04:00
Marc Durdin
7598566f83
Merge pull request #5800 from keymanapp/chore/disable-web-test
chore(web): disable registerstub test
2021-10-06 20:52:19 +11:00