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

[css-position] User-agent styles for top layer transitions #9912

Open
josepharhar opened this issue Feb 5, 2024 · 2 comments
Open

[css-position] User-agent styles for top layer transitions #9912

josepharhar opened this issue Feb 5, 2024 · 2 comments

Comments

@josepharhar
Copy link
Contributor

With the new css-position spec and overlay CSS property, it is possible for popovers, dialogs, and their ::backdrops to be in the top layer while transitioning from showing to hidden. During this time, :popover-open and :modal don't apply, but we still want the user-agent styles to apply as if these elements were still showing in the top layer. Otherwise, for example, dialog elements will jump to the top of the page as the exit animation starts.

I tried to fix this by adding an internal pseudo selector to match top layer elements and moving the user agent styles for dialog and popover into it here, but it was suggested to move the discussion to the csswg: whatwg/html#9387

Some possible solutions, some of which were discussed in that HTML PR:

  1. Do what my HTML PR did, which is to add an internal pseudo selector to match elements which are in the top layer and move the user-agent styles there. This has the benefit of not requiring the author to add any extra code to make this work.
  2. Add an externally exposed pseudo selector to match top layer elements which authors have access to, and also move user agent styles there. This also has the benefit of not requiring the author to add any extra code, and also has the benefit of allowing the author to do other stuff with it and override the user agent styles in a more ergonomic way.
  3. Add a shorthand value for transitioning called overlay-dialog and overlay-popover which expands both overlay and other relevant user-agent properties. Instead of using transition: overlay, you would use transition: overlay-dialog and transition: overlay-popover.

I prefer option 1 or 2 since it doesn't require the author to add extra stuff.

@tabatkins @fantasai

@nt1m
Copy link
Member

nt1m commented Feb 5, 2024

Additive CSS was the alternative to 3., if we could somehow transition: overlay in the UA stylesheet and have transition: opacity just "add over" transition: overlay, that could work nicely too.

@nt1m
Copy link
Member

nt1m commented Feb 5, 2024

Additive CSS could look like: transition-property: revert-layer, translate, then revert-layer would expand to the transition-property that is set in the UA stylesheet.

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

No branches or pull requests

3 participants