Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(web): better centralizes OSK layout internals to prepare for optimization efforts 🪠 #11176

Merged
merged 2 commits into from
Apr 12, 2024

Conversation

jahorton
Copy link
Contributor

@jahorton jahorton commented Apr 5, 2024

To prepare to optimize layout-reflow for Web's OSK, it will help us to better centralize functionality and properties related to the OSK's "layer group" element. Doing so will help us to precalculate and cache values related to layout reflow without actually triggering layout reflow repeatedly during use. An initial reflow may be needed to obtain specific values, though.

This PR has been spun off of an older state of #11140. Certain design decisions may make more sense with the whole picture in mind. In particular, the new verticalPadding property and its backing, cached field will help in reducing layout-reflow in followups.

@keymanapp-test-bot skip

Any testing relevant to do here may as well be done as part of #11140.

@keymanapp-test-bot
Copy link

User Test Results

Test specification and instructions

User tests are not required

@jahorton jahorton changed the title refactor(web): better centralizes OSK layout internals to prepare for optimization efforts refactor(web): better centralizes OSK layout internals to prepare for optimization efforts 🪠 Apr 5, 2024
@keymanapp-test-bot keymanapp-test-bot bot added this to the B17S5 milestone Apr 5, 2024
Base automatically changed from refactor/web/osk-spacebar-labeling to beta April 10, 2024 07:44
Comment on lines +269 to +274
// Should not trigger a new layout reflow; VisualKeyboard should have made
// no further DOM style changes since the last one.

// For touch-based OSK layouts, kmwosk.css may include top & bottom
// padding on the layer-group element.
const computedGroupStyle = getComputedStyle(this.element);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also of note: VisualKeyboard.refreshLayout() and .buildDocumentationKeyboard will not call this method unless the OSK is in the DOM, so we don't need to check for that.

Only just now realized that I left that assumption unstated here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment above ^^^ should be in the code, not in a PR comment.

@jahorton jahorton merged commit 50b261f into beta Apr 12, 2024
15 checks passed
@jahorton jahorton deleted the refactor/web/layer-group-encapsulation branch April 12, 2024 00:49
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 17.0.307-beta

Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine

Comment on lines +269 to +274
// Should not trigger a new layout reflow; VisualKeyboard should have made
// no further DOM style changes since the last one.

// For touch-based OSK layouts, kmwosk.css may include top & bottom
// padding on the layer-group element.
const computedGroupStyle = getComputedStyle(this.element);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment above ^^^ should be in the code, not in a PR comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants