Commit graph

1567 commits

Author SHA1 Message Date
Eberhard Beilharz
0020b98784
fix(web): fix error trying to calculate style scaling effects 🍒
PR #13860 fixed a similar error by adding a check for NaN. However, it
missed doing it for `layoutWidth` and only changed `layoutHeight`. This
PR adds a similar check to `layoutWidth` and will thus fix the error
we're still seeing in Sentry.

The same error could potentially happen in `internalHeight`, so we
add the check for NaN there as well. Addresses code review comments.

Also add unit tests for all three methods.

# User Testing

TEST_INUKTITUT_KEYBOARD: Using Keyman for Android, install the
`inuktitut_pirurvik` and verify that no error notifications appear.

Fixes: #14108
Fixes: [KEYMAN-WEB-RA](https://keyman.sentry.io/issues/6579536471/?referrer=github_integration)
Cherry-pick-of: #14684
2025-09-05 15:53:39 +02:00
Joshua Horton
8059970a7a
change(web): apply suggestion from code-review
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-16 13:58:08 +07:00
Joshua Horton
ecdfba020f fix(web): empty layout fontSize property should default to 1em
Fixes: #13908
Fixes: KEYMAN-WEB-RK
Cherry-pick-of: #13959

Fun fact:  `Number('')` returns 0, not NaN!  I thought it would do the latter in #13838, which is what led to the issue this PR addresses.
2025-05-16 13:19:14 +07:00
Joshua Horton
e929eb141e fix(web): sustain active batched-layout mode when keyboard is switched
Fixes: #13859
Fixes: KEYMAN-WEB-R4
Cherry-pick-of: #13860
2025-05-08 15:48:00 +07:00
Joshua Horton
04d479e5a9 change(web): use pt-style sizing for unitless touch-layout fontsizes
Cherry-pick-of: #13774
2025-05-06 09:44:31 +07:00
Joshua Horton
d58dd8e73c change(web): apply suggestion from PR review
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2025-05-06 09:44:31 +07:00
Joshua Horton
71d179f02f fix(web): add robustness for bad touch-layout fontsize specs
Fixes: #13766
Fixes: KEYMAN-WEB-QX

It seems that at some point, Developer has been compiling raw "12" values in the touch-layout JSON as a numeric 12 for the fontsize field.  This clearly happened for the inuktitut_pirurvik keyboard; we should also inspect urdu_phonetic, which has the same raw "12".

This change ensures that Web can handle this case without spewing tons of warning/error messages.  It also adds error-logging to help with diagnosis for any related issue in the future.
2025-05-06 09:44:31 +07:00
Joshua Horton
ab2c2f51cb
chore: fix indentation in worker-main/build.sh
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-02 08:13:47 +07:00
Joshua Horton
a29568744c maint(web): run LMLayer tests during standard Web module tests
Fixes: #12872

Test-bot: skip
2025-04-30 15:10:02 +07:00
Joshua Horton
cdda6e8ce5
Merge pull request #13646 from keymanapp/fix/web/match-osk-and-banner-font-scaling
fix(web): match banner font scaling to osk font scaling
2025-04-21 09:10:48 +07:00
Joshua Horton
a4164d2c0f
Merge pull request #13632 from keymanapp/change/web/set-classname-on-mobile-page-trailer
change(web): add unique classname to mobile-device page-trailer element
2025-04-10 13:21:37 +07:00
Eberhard Beilharz
c1683b4be2
chore(web): improve error logging
Previously logging an error resulted in two Sentry issues to be created.
This change now combines the log message and the error into one call to
`console.error`, thus resulting in only one Sentry issue being created.
2025-04-03 16:35:09 +02:00
Joshua Horton
970db6f823 chore(web): one more clean-up nit 2025-04-03 15:49:39 +07:00
Joshua Horton
41106a1d85 chore(web): code cleanup per review 2025-04-03 15:47:03 +07:00
Joshua Horton
8a6f5ac8ab fix(web): prevent div-by-zero potential from prior commit 2025-04-03 08:12:02 +07:00
Joshua Horton
8a5c49c585 change(web): keyman-page-trailer -> kmw-page-trailer in order to match common prefix 2025-04-02 13:45:09 +07:00
Joshua Horton
831ca4eeaf fix(web): add banner font downscaling
Fixes: #13644

The banner should also double-check the height of its suggestions, applying downscaling where needed to ensure the suggestions' text does not flow out of bounds.  Additionally, if the main keyboard body's keys required downscaling due to text height, this will likely also result in similar scaling for the suggestions.
2025-04-02 13:15:24 +07:00
Joshua Horton
426e3d1d3a fix(web): apply layout font-scaling to banner
When a keyboard's layout specifies font-upscaling, that scaling should also be applied to the banner.  This was not previously being done, which could lead to font-size discrepancies between the two (as noted with `khmer_angkor` in the base issue).
2025-04-02 13:15:20 +07:00
Joshua Horton
cd322340df change(web): add unique classname to mobile-device page-trailer element
Addresses, but does not fix, #13588.

This change provides a simple classname to the page-trailer element Keyman Engine for Web adds to pages when in mobile mode.  This "page trailer" was originally added so that the on-screen keyboard does not hide important elements near the bottom of the page when visible.  That said, we have gotten site-designer complaints about it; exposing a way for site-designers to retrieve it in queries and/or customize its properties will provide a reasonable workaround for such cases.
2025-04-01 11:45:46 +07:00
Joshua Horton
eae55e4fa1 fix(web): remove extra px offset from last OSK row
Fixes: #13620

Turns out there was actually a final-row pixel offset being applied for the OSK.  I _believe_ this was something originally done for touch-oriented OSKs that ended up applied to all during 17.0's OSK refactoring efforts.

kmwosk.css does define layer-group padding above and below (1 px each) for touch keyboards already.  Furthermore, things look fine when removing this extra 1px offset on the bottom from the last row.  I think we're fine to just drop this minor offset and move on for now.
2025-03-31 10:41:50 +07:00
Joshua Horton
71df37930f
Merge pull request #13360 from keymanapp/feat/web/gesture-error-traces
feat(web): adds gesture 'traces' for warning/error logging
2025-03-19 08:13:48 +07:00
Joshua Horton
a015fd0296 change(web): context-state logging now oldest to most recent
The gesture traces themselves, within their indentation, maintain stacktrace-style ordering.
2025-03-18 14:19:37 +07:00
Joshua Horton
76a5e067e9 fix(web): unload and load should use consistent, canEnable check
Fixes: #13512
Fixes: KEYMAN-WEB-QD
2025-03-18 14:07:07 +07:00
Joshua Horton
1b8c2d8776
Merge pull request #13359 from keymanapp/fix/web/bksp-auto-cancel-on-new-input
fix(web): cancel held backspace on new key input
2025-03-17 08:39:36 +07:00
Joshua Horton
fba9b236cc fix(web): cancel held backspace on new key input
As identified in the analysis for #13344, held backspaces have not been cancelled when receiving new inputs.  It's better and cleaner to have it act similarly to normal keystrokes - receiving a new key input autocompletes any currently-held output keys.

The current, existing behavior also has the potential to get particularly messy with multitaps, which restore the context at their start.  If a backspace is held and then a multitap begins, each new tap of the multitap would undo the backspaces that triggered since the first tap of the multitap.
2025-02-27 13:00:44 +07:00
Joshua Horton
94827b52b2 feat(web): adds gesture 'traces' for warning/error logging
To facilitate debugging cases where gestures don't work as intended, this adds sanitized logging for keystrokes resulting for gestures.  These are only to be output when a relevant error or warning is emitted.

This is primarily being added to facilitate investigation of #13344.
2025-02-27 12:50:35 +07:00
Joshua Horton
2db8fa089c chore(web): clean a few commented-out vars 2025-02-27 09:36:25 +07:00
Joshua Horton
f254f38440 chore(web): remove dead osk-height calculation method
Some of the OSK optimization rework in 17.0 found a better way to handle this that has proven stable; no reason to keep it around any longer.
2025-02-27 09:34:35 +07:00
Joshua Horton
b7c13bdc66 chore(web): remove dead key-target function 2025-02-27 09:31:13 +07:00
Joshua Horton
ecc3bc18e7 chore(web): remove dead bksp functions
These were replaced by the HeldRepeater gesture-handler type.
2025-02-27 09:28:18 +07:00
Joshua Horton
5db10ea436
Merge pull request #13331 from keymanapp/fix/web/init-should-not-cookie-default
fix(web): prevent cookie-default behavior from mangling engine init
2025-02-26 09:29:54 +07:00
Joshua Horton
0a8c99e322
Merge pull request #13291 from keymanapp/fix/web/engine-main-headless-tests
fix(web): reconnect, patch up engine/main headless unit tests
2025-02-25 08:17:48 +07:00
Joshua Horton
72a9e8b8fe fix(web): fix up applied suggestion - properly "fill in" Worker type 2025-02-24 13:06:17 +07:00
Joshua Horton
f3946ffc76 fix(web): prevent cookie-default behavior from mangling engine init
Fixes: #13278

The fallback default keyboard corresponding to an uninitialized cookie is `Keyboard_us:en`.   This should only occur if the site actually registers its stub before initialization - and we weren't checking/filtering for this properly.

The error itself only occurred if there _were_ stubs pre-registered before init - if none existed, the error does not result.
2025-02-24 12:37:09 +07:00
Joshua Horton
accdb3752e
change(web): apply focused try-catch suggestion from review
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-02-24 09:15:50 +07:00
Joshua Horton
3d879ed295 docs(web): remove outdated comment in engine/main/build.sh 2025-02-21 08:16:21 +07:00
Joshua Horton
94df946b0e fix(web): reconnect, patch up engine/main headless unit tests 2025-02-20 12:13:11 +07:00
Joshua Horton
a5c987116b fix(web): patches up affected unit test 2025-02-20 12:11:41 +07:00
Joshua Horton
baf2150542 fix(web): properly support workerless use of Web engine
Fixes: #13262
Fixes: KEYMANWEB-COM-1VH
2025-02-20 12:06:28 +07:00
Joshua Horton
94023cd692 fix(web): provide informative error + message when loading UI without the engine
Fixes: #13261
2025-02-18 09:47:17 +07:00
Joshua Horton
14bca9fffd
Merge pull request #13196 from keymanapp/chore/web/fix-coverage-reporting
chore(web): fix coverage-reporting artifact
2025-02-14 14:57:05 +07:00
Joshua Horton
90b4318d84
Merge pull request #13158 from keymanapp/chore/web/top-level-clean-predictive-text
chore(web): ensure /web/build.sh clean triggers all predictive-text child actions
2025-02-14 14:56:52 +07:00
Joshua Horton
7feb496718
Merge pull request #13141 from keymanapp/change/web/drop-CI-unit-test-concurrency
change(web): drop 'dom' unit test concurrency when run in CI mode
2025-02-14 14:56:37 +07:00
Joshua Horton
39c1727b6f change(web): use env.KEYMAN_ROOT instead of custom function 2025-02-12 15:57:02 +07:00
Joshua Horton
b2598e76ba chore(web): fix coverage-reporting artifact
Fixes: #13195
2025-02-12 15:56:54 +07:00
Joshua Horton
3e456bbf3b chore(web): top-level clean affects predictive-text child projects
Addresses parts of #12735.
2025-02-07 10:02:56 +07:00
Joshua Horton
95dae2079e change(web): drop 'dom' unit test concurrency when run in CI mode 2025-02-06 14:34:10 +07:00
Joshua Horton
c3cd0493ff docs(web): relocate gesture docs to web/docs/internal 2025-02-06 10:33:28 +07:00
Joshua Horton
0e7b47e075
Merge pull request #12927 from keymanapp/fix/web/context-match-applied-suggestions
fix(web): correctly track context transitions caused by applying suggestions 🖲️
2025-02-03 15:11:01 +07:00
Joshua Horton
3c7ae5d7f6
Merge pull request #12925 from keymanapp/fix/web/context-match-path-ordering
fix(web): correct edit-path ordering at source 🖲️
2025-02-03 15:10:50 +07:00