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

Dialog changing from position absolute to fixed #225

Open
craigfrancis opened this issue Sep 18, 2021 · 0 comments
Open

Dialog changing from position absolute to fixed #225

craigfrancis opened this issue Sep 18, 2021 · 0 comments

Comments

@craigfrancis
Copy link
Contributor

Looks like <dialog> is now using position: fixed... as of Chrome 93?

w3c/csswg-drafts#4645
https://www.chromestatus.com/feature/5756963046555648

Not looked into the details yet, but this can cause the window to scroll to the top with showModal(), which is annoying if showing/hiding the dialog, and finding yourself at the top of the page.

Quick fix for now...

  1. CSS dialog to use position: fixed, to match the updated default behaviour.
  2. JS needsCentering() to include && computedStyle.position != 'fixed'
  3. JS reposition() to use element.style.top = ((window.innerHeight - element.offsetHeight) / 2) + 'px';

I suspect that might cause other issues, but that's seems to have fixed my immediate problem.

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

No branches or pull requests

1 participant