Open progers opened 7 months ago
Wouldn't the new transition-behavior: allow-discrete
along with this behavior allow changes in visibility triggered by position-visibility
to be animated?
The visibility triggered by position-visibility
is internal to the engine and is not exposed to authors. https://github.com/w3c/csswg-drafts/issues/7758#issuecomment-1980302892 brought up many good points about this topic, such as tying this to the existing visibility
property.
Yeah, I think the right approach might be:
strongly-hidden
value to visibility
. This forces the descendants of the element to also compute to strongly-hidden
, regardless of their specified value.position-visibility
pivots to actually causing visibility
to compute to strongly-hidden
.hidden
.I did not see this issue when filling https://github.com/w3c/csswg-drafts/issues/10411, so I will copy its content here (and close as duplicate), as it also mentions that just having the visibility
won't be enough to animate showing/hiding of something with position-visibility
.
Right now, the effect of
position-visibility
(https://drafts.csswg.org/css-anchor-position-1/#position-visibility) is immediate, making it sometimes a bit jarring when the anchored element hides/appears.I can see authors wanting to design this transition: through opacity, translate or any other way they want to design the regular enter/leave transition for their anchored elements.
For popovers we can design the transition via a combination of
:popover-open
and@starting-style
(https://nerdy.dev/using-starting-style-and-transition-behavior-for-enter-and-exit-stage-effects), but for cases like withposition-visibility
we don't have any hooks that we currently could use for this.I am not yet sure what the solution could be, but I am certain that we need one. Open questions:
- Should we somehow reuse the
@starting-style
?- Will we need the
@ending-style
or something like that in the absence of:popover-open
alternative?- Or could we say that when the element hides via
position-visibility
it uses the@starting-style
if it is defined as the styles it will transition to?- If we'd add the above, should we have a new keyword in the
transition-property
to cover the visibility part of the transition itself, likeposition-visibility
? Or we could reusevisibility
there?
The CSS Working Group just discussed [css-anchor-1] position-visibility show/hide animations
, and agreed to the following:
RESOLVED: when position visibility hides something, it does so by causing the visibility property to compute to a new force-hidden value
Many tooltips use an animation effect. An example is the tooltips here on github: if you hover over the notification icon in the top-right, an opacity 0->1 animation is used for the tooltip. A simple proposal for anchor positioning would be:
The current spec for position visibility (link) states that hidden anchors are strongly hidden. This would need to change so that it takes effect after the hide animation, and stop taking effect before the show-animation.
@tabatkins @una