Bug 227615 - animation-fill-mode does not correctly apply viewport-based units
Summary: animation-fill-mode does not correctly apply viewport-based units
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: https://will.harris.ch/tcr-animation-...
Keywords: HasReduction, InRadar
Depends on:
Blocks:
 
Reported: 2021-07-02 03:14 PDT by Will Harris
Modified: 2024-02-16 01:24 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Will Harris 2021-07-02 03:14:48 PDT
If an animation is applied with an "animation-fill-mode", and the values in the first/last animation frame are expressed using viewport units (vw, vh), the affected element will not be correctly positioned if the viewport is subsequently resized after the animation has ended (e.g. desktop browser when resizing, mobile browser when orientation is changed).

The attached test case reduction shows the issue. It contains three divs, all positioned with viewport units:

- one reference div, unanimated
- one div animated without "animation-fill-mode"
- one div animated with "animation-fill-mode"

The animated divs share the same animation and CSS positioning. The only difference is that the last div's animation also uses a fill mode.

When the browser window is resized, the top two divs move correctly, and remain aligned with a reference marker line. The last div does not move as expected to respect the changed viewport size.
Comment 1 Will Harris 2021-07-02 03:16:16 PDT
Chrome and Firefox show what I would consider the correct behaviour.
Comment 2 Radar WebKit Bug Importer 2021-07-02 03:23:53 PDT
<rdar://problem/80075191>
Comment 3 Smoley 2021-07-15 13:23:19 PDT
It looks like the test case failed to attach. Please try adding it again.
Comment 4 Will Harris 2021-07-16 06:40:50 PDT
Sorry, test case added in the URL field:

https://will.harris.ch/tcr-animation-fill-mode.html
Comment 5 Antoine Quint 2021-09-08 07:38:50 PDT
Thanks for filing this., I can reproduce the issue with STP 131.
Comment 6 Ahmad Saleem 2024-02-16 01:24:59 PST
It is still reproducible in STP188 using attached test case where while animation is running, if you change window size, the last div is stuck.