Re: [csswg-drafts] [css-transitions] Reading computed styles can immediately start then cancel transitions on newly mounted elements (#10187)

I think what you observed is working as intended. In your simple example:

1. The element is mounted
2. Since the element doesn't have any matched `opacity` rules atm, calling `getComputedStyle(...)` sets the element's computed `opacity` to `1`
3. A class is set on the element, but its style hasn't been recomputed yet
4. In the `requestAnimationFrame` callback, its class is changed
5. The element's style is recomputed, and the computed `opacity` value is still `1`

So there's no transition at all, because the element's style is only computed twice, and the computed value remains `1`

-- 
GitHub Notification of comment by xiaochengh
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10187#issuecomment-2065818270 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 19 April 2024 06:00:27 UTC