You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For what it's worth, I think it's weird that this can only be set by transitions and not animations. If we want to keep that behavior, I think we need to specify exactly how that works.
For example, if a CSSTransition object has no owning element, does the overlay property specified on any associated keyframe effect still have an effect?
The fact that only transitions can set it is only defined in non-normative text (although later normative text assumes it to be the case) and the decision to make ignoring transitions in some circumstances undefined is going to cause interop issues:
User agents may, at their discretion, remove a running transition on overlay. The conditions for this are intentionally undefined.
For example, does pausing such a transition cause it to be ignored? What about seeking it?
For what it's worth, I think it's weird that this can only be set by transitions and not animations. If we want to keep that behavior, I think we need to specify exactly how that works.
For example, if a CSSTransition object has no owning element, does the overlay property specified on any associated keyframe effect still have an effect?
The fact that only transitions can set it is only defined in non-normative text (although later normative text assumes it to be the case) and the decision to make ignoring transitions in some circumstances undefined is going to cause interop issues:
User agents may, at their discretion, remove a running transition on overlay. The conditions for this are intentionally undefined.
For example, does pausing such a transition cause it to be ignored? What about seeking it?
I think as it is currently only used in a very specific context (Popover API, allow-discrete) and setting it by a transition property basically enables animating it, these use cases can be described quite clearly.
The user agent setting it is by the spec also reserved for the specific use case of preventing potential abuse scenarios. This would require a specific list of conditions to specify what would be considered as abuse.
I haven't looked at the implementation in Chromium, but I would assume this work has already been done in their implementation.
However I think it is well defined how it works in terms of animations unless I'm missing something?
In particular, it's defined to be * { overlay: none !important } at the UA-stylesheet level, which overrides animations, right?
Yeah, I think you're right (since animations without an owning element target the animations level of the cascade (ref)).
That said, I still think this should be available to regular animations too since my experience with modal dialogs has shown transitions are sometimes not sufficient for outro animations (e.g.).
I'm also a bit concerned the deliberately undefined heuristics for ignoring transitions are possibly going to cause interop headaches.
It's also not entirely trivial to come up with good heuristics. For example, pausing a transition could cause it to persist its effect forever which could be abused. Ignoring paused transitions, however, would make DevTools less useful since you wouldn't be able to inspect outro animations. Likewise for transitions whose playback rate is slowed down significantly, or transitions that are periodically seek-ed backwards such that they never end.
Right. Per the spec, nothing prevents you from applying an 'overlay' animation, it's just not going to do anything, due to the property always having a value set in the UA-important cascade origin. Due to the way transitions work, they'll activate and apply even between UA-important value changes, but animations apply between the author and author-important cascade origins, so they'll be ignored.
That said, I still think this should be available to regular animations too since my experience with modal dialogs has shown transitions are sometimes not sufficient for outro animations
Without some additional magic, it's not possible to allow something in animations but not in normal properties, so we'd need some extra hand-waving there. Even if we did that, tho, it would still allow authors to keep things in the top layer indefinitely. (The spec uses the 'overlay' value as part of its logic on when to remove something from the top layer.) We'd have to invoke the "kick it out anyway" heuristic more aggressively, whereas currently it's something that should only trigger when you're doing something weird.
I'm also a bit concerned the deliberately undefined heuristics for ignoring transitions are possibly going to cause interop headaches.
It's completely undefined at the moment to allow exploration; we'd be happy to add some actual rules based on implementation experience. The expectation, tho, is that it would only get applied to "weird" cases - a transition lasting many seconds, for example. If your "leaving the top layer" animation is >15s long, you're doing something incredibly weird.
It's also not entirely trivial to come up with good heuristics.
This is a big part of why we haven't specified them in detail yet. For example, I could imagine the heuristic allowing them to persist indefinitely if DevTools is open.
That said, I still think this should be available to regular animations too since my experience with modal dialogs has shown transitions are sometimes not sufficient for outro animations
Without some additional magic, it's not possible to allow something in animations but not in normal properties, so we'd need some extra hand-waving there. Even if we did that, tho, it would still allow authors to keep things in the top layer indefinitely. (The spec uses the 'overlay' value as part of its logic on when to remove something from the top layer.) We'd have to invoke the "kick it out anyway" heuristic more aggressively, whereas currently it's something that should only trigger when you're doing something weird.
Yeah, I can see that would be difficult. Maybe it's ok for overlay to only be animatable via transitions initially and we can explore ways to expand that later.
In my case, I was building a drawer component using a modal <dialog> and transitions were an awkward fit for the outro animation. (From memory, at least one issue was the duration of the outro animation varies based on the computed height of the drawer.) Instead, I ended up blocking close requests, running the outro animation using Web Animations, then closing the dialog when they complete—awkward and error prone but maybe good enough for now.
I'll say I definitely sympathize with the use-case; the fact that you have to coordinate an outro animation with the transition is definitely bad. It's just weighed against the confusion potential of 'overlay' not really doing anything for authors; if it was settable, all they could do would be (a) delay an element from leaving the top layer (by setting overlay:auto before it leaves), or (b) force an element in the top layer list to not render in the top layer (by setting overlay:none while it's in the top layer list). In all other situations it would do nothing regardless of value, and that's weird.
All around it's kinda a weird thing, unfortunately.
I think the general problem space is real, but I think we should just fix the top layer exit to either be easier to hook into (e.g. via something in beforetoggle) or something along those lines.
easier to hook into (e.g. via something in beforetoggle)
Does this require script? I think this should stay in CSS. What if we used transition: display allow-discrete as an opt-in to make a top layer exit animation?
Activity
zcorpan commentedon Apr 13, 2023
@dholbert @emilio
SebastianZ commentedon Apr 19, 2023
As Alan Stearns points out in w3c/csswg-drafts#8730, there's still an open discussion.
Sebastian
itpropro commentedon Oct 5, 2024
w3c/csswg-drafts#8730 was resolved over a year ago, has the position changed or are there plans to work on https://bugzilla.mozilla.org/show_bug.cgi?id=1841456?
birtles commentedon Oct 7, 2024
For what it's worth, I think it's weird that this can only be set by transitions and not animations. If we want to keep that behavior, I think we need to specify exactly how that works.
For example, if a
CSSTransitionobject has no owning element, does theoverlayproperty specified on any associated keyframe effect still have an effect?The fact that only transitions can set it is only defined in non-normative text (although later normative text assumes it to be the case) and the decision to make ignoring transitions in some circumstances undefined is going to cause interop issues:
For example, does pausing such a transition cause it to be ignored? What about seeking it?
itpropro commentedon Oct 8, 2024
I think as it is currently only used in a very specific context (Popover API,
allow-discrete) and setting it by a transition property basically enables animating it, these use cases can be described quite clearly.The user agent setting it is by the spec also reserved for the specific use case of preventing potential abuse scenarios. This would require a specific list of conditions to specify what would be considered as abuse.
I haven't looked at the implementation in Chromium, but I would assume this work has already been done in their implementation.
birtles commentedon Oct 8, 2024
I don't doubt the utility of this-I use it myself. I'm just saying this needs spec work/discussion.
emilio commentedon Oct 15, 2024
I think I agree with @birtles, this in general feels very narrowly scope.
However I think it is well defined how it works in terms of animations unless I'm missing something?
In particular, it's defined to be
* { overlay: none !important }at the UA-stylesheet level, which overrides animations, right?birtles commentedon Oct 15, 2024
Yeah, I think you're right (since animations without an owning element target the animations level of the cascade (ref)).
That said, I still think this should be available to regular animations too since my experience with modal dialogs has shown transitions are sometimes not sufficient for outro animations (e.g.).
I'm also a bit concerned the deliberately undefined heuristics for ignoring transitions are possibly going to cause interop headaches.
It's also not entirely trivial to come up with good heuristics. For example, pausing a transition could cause it to persist its effect forever which could be abused. Ignoring paused transitions, however, would make DevTools less useful since you wouldn't be able to inspect outro animations. Likewise for transitions whose playback rate is slowed down significantly, or transitions that are periodically seek-ed backwards such that they never end.
tabatkins commentedon Oct 15, 2024
Right. Per the spec, nothing prevents you from applying an 'overlay' animation, it's just not going to do anything, due to the property always having a value set in the UA-important cascade origin. Due to the way transitions work, they'll activate and apply even between UA-important value changes, but animations apply between the author and author-important cascade origins, so they'll be ignored.
Without some additional magic, it's not possible to allow something in animations but not in normal properties, so we'd need some extra hand-waving there. Even if we did that, tho, it would still allow authors to keep things in the top layer indefinitely. (The spec uses the 'overlay' value as part of its logic on when to remove something from the top layer.) We'd have to invoke the "kick it out anyway" heuristic more aggressively, whereas currently it's something that should only trigger when you're doing something weird.
It's completely undefined at the moment to allow exploration; we'd be happy to add some actual rules based on implementation experience. The expectation, tho, is that it would only get applied to "weird" cases - a transition lasting many seconds, for example. If your "leaving the top layer" animation is >15s long, you're doing something incredibly weird.
This is a big part of why we haven't specified them in detail yet. For example, I could imagine the heuristic allowing them to persist indefinitely if DevTools is open.
birtles commentedon Oct 16, 2024
Yeah, I can see that would be difficult. Maybe it's ok for
overlayto only be animatable via transitions initially and we can explore ways to expand that later.In my case, I was building a drawer component using a modal
<dialog>and transitions were an awkward fit for the outro animation. (From memory, at least one issue was the duration of the outro animation varies based on the computed height of the drawer.) Instead, I ended up blocking close requests, running the outro animation using Web Animations, then closing the dialog when they complete—awkward and error prone but maybe good enough for now.tabatkins commentedon Oct 16, 2024
I'll say I definitely sympathize with the use-case; the fact that you have to coordinate an outro animation with the transition is definitely bad. It's just weighed against the confusion potential of 'overlay' not really doing anything for authors; if it was settable, all they could do would be (a) delay an element from leaving the top layer (by setting
overlay:autobefore it leaves), or (b) force an element in the top layer list to not render in the top layer (by settingoverlay:nonewhile it's in the top layer list). In all other situations it would do nothing regardless of value, and that's weird.All around it's kinda a weird thing, unfortunately.
emilio commentedon Nov 9, 2026
I think the general problem space is real, but I think we should just fix the top layer exit to either be easier to hook into (e.g. via something in beforetoggle) or something along those lines.
The
overlaydesign doesn't quite work, see also w3c/csswg-drafts#14697.So propose negative.
josepharhar commentedon Nov 9, 2026
Does this require script? I think this should stay in CSS. What if we used
transition: display allow-discreteas an opt-in to make a top layer exit animation?