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

> Given that this even happens when there's a call for *any element* in the subtree of the transitioning element

There's no way to recompute the style of a descendent element without recomputing the ancestor, given how style inheritance works. And that will cause a style change on the ancestor.

> is there any way to counteract this other than temporarily resetting transition to none, forcing a reflow, then restoring its old value? 

I think the right fix is: set the element's class first before attaching it to the tree. In your examples, it will be moving step 3 before step 1.

I also don't think there's anything thing to do on the spec side. If you want a switch to control when to ignore style changes and when not to -- that's exactly the `transition` property itself.

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


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

Received on Friday, 3 May 2024 04:08:06 UTC