RESOLVED FIXED299952
Animation not updated when Container Query units are used
https://bugs.webkit.org/show_bug.cgi?id=299952
Summary Animation not updated when Container Query units are used
Rene Haas
Reported 2025-10-01 06:23:01 PDT
Created attachment 476917 [details] Reproduction Example When an animation is created which has container query units such as "cqw" or "cqh", then its not being updated when the parent container becomes a container. Reproduction: 1. Create an animation which has some sort of container query units 2. At the point in time where the animation is being added the container query units use their viewport fallback because we didnt specify `container-type` 3. After a short delay specify `container-type` so the container query units become useful 4. notice that the animation still uses the fallback viewport units This works in chrome. In the attached example I'm using a ScrollTimeline as the animation timeline.
Attachments
Reproduction Example (1.51 KB, text/html)
2025-10-01 06:23 PDT, Rene Haas
no flags
Reproduction Example without ScrollTimeline (1.04 KB, text/html)
2025-10-01 08:21 PDT, Rene Haas
no flags
Rene Haas
Comment 1 2025-10-01 08:21:54 PDT
Created attachment 476923 [details] Reproduction Example without ScrollTimeline
Rene Haas
Comment 2 2025-10-01 08:26:38 PDT
This doesn't seem to happen if animations are declared completely in CSS. I could only reproducate with the `element.animate()` API.
Radar WebKit Bug Importer
Comment 3 2025-10-08 06:23:13 PDT
Antoine Quint
Comment 4 2025-10-13 06:43:08 PDT
We likely need to add some logic to `KeyframeEffect::recomputeKeyframesIfNecessary` to deal with a change related to container units.
Antoine Quint
Comment 5 2025-10-13 06:45:23 PDT
Indeed, I expect CSS Animations are not a concern because the underlying CSS parsed values are updated. We need additional logic when the CSS values are provided via the JS API.
Antoine Quint
Comment 6 2025-10-14 06:45:46 PDT
Turns out there is custom logic for CSS Animations under `Styleable::queryContainerDidChange()`. We need to make that function's effect broader.
Antoine Quint
Comment 7 2025-10-14 07:12:07 PDT
Antoine Quint
Comment 8 2025-10-15 08:40:25 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/55455
EWS
Comment 9 2025-10-15 15:10:31 PDT
Committed 301584@main (1fab1713b7b7): <https://commits.webkit.org/301584@main> Reviewed commits have been landed. Closing PR #52296 and removing active labels.
Rene Haas
Comment 10 2025-10-22 00:42:01 PDT
Antoine Quint do you know when this fix will land in Safari / in which Safari version it will land?
Antoine Quint
Comment 11 2025-10-22 01:00:10 PDT
I can't provide that information at the moment Rene since Apple does not comment on upcoming software releases. As new Safari Technology Preview releases ship, their announcement include the range of commits included, so you can watch this for testing purposes. As for Safari proper, I'm afraid we don't have a system in place to automatically indicate in the relevant bugs that it's been made available in a beta or final Safari release.
Note You need to log in before you can comment on or make changes to this bug.