fix(web): fix error trying to calculate style scaling effects#14684
fix(web): fix error trying to calculate style scaling effects#14684ermshiperete merged 2 commits intomasterfrom
Conversation
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. Also add unit tests for both 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)
User Test ResultsTest specification and instructions Test Artifacts
|
| if (this.usesFixedWidthScaling) { | ||
| let baseWidth = this.width; | ||
| baseWidth -= this._borderWidth * 2; | ||
| baseWidth = (isNaN(baseWidth) || baseWidth < 0) ? 0 : baseWidth; |
There was a problem hiding this comment.
Does get internalHeight() (l.820) have a similar pattern to check?
There was a problem hiding this comment.
Does a baseWidth of zero actually make sense?
There was a problem hiding this comment.
Good question. @jahorton Do you have any insights on that?
There was a problem hiding this comment.
I think this scenario generally reflects when Keyman Engine for Web is still initializing - or perhaps if the hosting WebView has been backgrounded temporarily, before it's fully back in the view hierarchy. If memory serves, the correct values generally come through pretty quickly thereafter.
Test ResultsBefore testing:
|
| if (this.usesFixedWidthScaling) { | ||
| let baseWidth = this.width; | ||
| baseWidth -= this._borderWidth * 2; | ||
| baseWidth = (isNaN(baseWidth) || baseWidth < 0) ? 0 : baseWidth; |
There was a problem hiding this comment.
Does a baseWidth of zero actually make sense?
The same error could potentially happen in `internalHeight`, so we add the check for NaN there as well. Addresses code review comments.
| it('calculates InternalHeight correctly for number', () => { | ||
| const vk = createVisualKeyboard(); | ||
| vk['_height'] = 100; | ||
| assert.equal(vk.internalHeight.val, 88); |
There was a problem hiding this comment.
@jahorton The values we get from internalHeight look wrong since we're subtracting the borders twice. Or is that intentional?
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
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 `internalHeight` and will thus fix the error we're still seeing in Sentry. Also add unit tests for all three methods. Fixes: #14108 Fixes: [KEYMAN-WEB-RA](https://keyman.sentry.io/issues/6579536471/?referrer=github_integration) Cherry-pick-of: #14684
|
Changes in this pull request will be available for download in Keyman version 19.0.114-alpha |
PR #13860 fixed a similar error by adding a check for NaN. However, it missed doing it for
layoutWidthand only changedlayoutHeight.This PR adds a similar check to
layoutWidthand will thus fix the error we're still seeing in Sentry.Also add unit tests for both methods.
User Testing
TEST_INUKTITUT_KEYBOARD: Using Keyman for Android, install the
inuktitut_pirurvikand verify that no error notifications appear.Fixes: #14108
Fixes: KEYMAN-WEB-RA