Merge pull request #6861 from keymanapp/fix/web/stable/6853-refresh-layout-undef-guard

fix(web): better stability during transient OSK load state 🍒
This commit is contained in:
Joshua Horton 2022-06-29 13:30:05 +07:00 • committed by GitHub
commit 133d6ca5a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -450,7 +450,8 @@ namespace com.keyman.osk {
}
// Step 1: have the necessary conditions been met?
const fixedSize = this.width && this.height && this.width.absolute && this.height.absolute;
const hasDimensions = this.width && this.height;
const fixedSize = hasDimensions && this.width.absolute && this.height.absolute;
const computedStyle = getComputedStyle(this._Box);
const isInDOM = computedStyle.height != '' && computedStyle.height != 'auto';
@ -458,7 +459,7 @@ namespace com.keyman.osk {
if(fixedSize) {
this._computedWidth = this.width.val;
this._computedHeight = this.height.val;
} else if(isInDOM) {
} else if(isInDOM && hasDimensions) {
const parent = this._Box.offsetParent as HTMLElement;
this._computedWidth = this.width.val * (this.width.absolute ? 1 : parent.offsetWidth);
this._computedHeight = this.height.val * (this.height.absolute ? 1 : parent.offsetHeight);