Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
@langermank and I were debugging as to why Overlay seems to only work properly on my devices... when we figured out that I have
prefers-reduced-motion
set!In
anchored-position
, the following steps happen:IntersectionObserver
is registered.IntersectionObserver
triggersanchored-position#update()
.prefers-reduced-motion
then no animation playsprefers-reduced-motion
then:scaleFade
animation kicks in. It starts atscale(0.5)
which changes theBoundingClientRect
ofanchored-position
to be half the size.scale(1)
There are several not-ideal solutions to all of this:
anchored-position
can listen foranimationend
and callupdate()
. This will have a "popping" effect as when the animation ends the element will reflow into positionscaleFade
can add padding/margin to accommodate for the change in scale, keeping a consistentBoundingClientRect
. This will be very difficult to achieve in CSS alone.getAnimations()
and if it is occuring, then callupdate()
on each animationframe until the animation has completed. This can be very computationally expensive and may slow down animations as each frame the position will need to be recalculatedBoundingClientRect
- such as a fade-in animation.