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

Ensure that Javascript doesn't change the DOM after page render without user interaction #282

Open
alaroia-cfa opened this issue Aug 6, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@alaroia-cfa
Copy link
Contributor

Honeycrisp components, such as reveals, accordions, and file upload buttons, are modified by Javascript after a page is rendered. This causes layout jank, in which the page is rendered and then after a brief moment changes it's visible contents, modifying the layout. It also causes flakiness in javascript-enabled feature specs that access these pages.

Current setup

Javascript, on page load, adds classes to DOM elements, causing existing CSS to hide those elements.

Proposed setup

A minimal amount of javascript is executed before the page finishes loading, which adds a special "js-enabled" class to the body or html element (because they will exist before the page finishes loading), and the CSS to hide elements will be scoped within ".js-enabled".

Sample HTML & JS: https://jsbin.com/nequnegaci/1/edit?html,output

@alaroia-cfa alaroia-cfa added the enhancement New feature or request label Aug 6, 2021
@alaroia-cfa
Copy link
Contributor Author

When I have an accordion open, then I navigate away from the page, and I click back in the browser, I expect the accordion to remain open. However, with Honeycrisp, it is auto-closed.

Here's an animated GIF of the behavior right now.

Screen Recording 2021-08-12 at 6 22 06 PM (1)

I believe that if this issue (#282) is resolved, I will get my expected behavior. I believe (untested) that the current behavior of closing the accordion is due to Honeycrisp hooking the browser's navigation (loading) when I click back and modifying the DOM. If Honeycrisp only modified the DOM on user interaction, then the back-forward cache would ensure the expanded accordion would stay expanded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant