Bug 46041 - CSS inheritance delayed when transition duration on parent and child elements
Summary: CSS inheritance delayed when transition duration on parent and child elements
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-09-18 14:10 PDT by Sidney San Martín
Modified: 2024-01-25 07:23 PST (History)
13 users (show)

See Also:


Attachments
Demo of font-size not being inherited until the transition is complete (1.01 KB, text/html)
2010-09-18 14:10 PDT, Sidney San Martín
no flags Details
Test case (676 bytes, text/html)
2012-03-23 16:26 PDT, Rob Arnold
no flags Details
Testcase with logging (899 bytes, text/html)
2024-01-25 04:16 PST, Antoine Quint
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sidney San Martín 2010-09-18 14:10:24 PDT
Created attachment 68015 [details]
Demo of font-size not being inherited until the transition is complete

When both a parent and a child element have -webkit-transition-durations for an inherited style property, and the property changes on the parent element, the property does not begin to change on the child element until the transition is complete on the parent. This only appears to happen in some cases

Try clicking the outer element in the demo a few times. When it adds and removes a class from the outer element that increases its font-size. When the class is added, the font-size of the inner element does not change until the transition is complete, but when it is removed, the transitions happen simultaneously. If you remove the -webkit-transition-duration from the inner element, the font-size transitions happen simultaneously in both directions.
Comment 1 Rob Arnold 2012-03-23 16:26:29 PDT
Created attachment 133584 [details]
Test case

I also ran across this playing around with background-color
Comment 2 Scott 2015-07-13 03:14:54 PDT
This is still an issue almost 5 years later. My main concern with this reported issue is that it is still not seen as a priority and yet there is no CSS workaround for many use cases.
Comment 3 Radar WebKit Bug Importer 2015-07-13 09:04:49 PDT
<rdar://problem/21793947>
Comment 4 shrpne 2017-01-09 08:28:25 PST
Here is another showcase http://codepen.io/schonert/details/ovjhd/
And it is still not fixed for 6 years
Comment 5 Alexandre Bonneau 2017-08-24 11:57:25 PDT
Perhaps this is related ; you can clearly see the faulty behavior on this live  example : https://codepen.io/AnotherLinuxUser/pen/ZJRNWP?editors=1100

Is there any way this gets more traction after 7 years?
Comment 6 Alexandre Bonneau 2017-08-24 12:09:09 PDT
This is the workaround for the problem I posted earlier ; at comment #1 mentioned, you have to just through hoops in order to avoid having a transition on the parent and child at the same time.

The workaround : https://codepen.io/AnotherLinuxUser/pen/MvBEzN?editors=1100

The bug still needs fixing though ;)
Comment 8 Ahmad Saleem 2023-08-16 15:53:40 PDT
I am able to reproduce this bug using WebKit ToT (266957@main) using following test case (from Comment 05): https://codepen.io/AnotherLinuxUser/pen/ZJRNWP?editors=1100

^ If you hover on 'XXX', it will take some time to reflect background update on 'There is a delay here'.

WebKit & Chrome Canary 118 both have this issue while Firefox Nightly 118 does not have this issue and reflect update immediately.
Comment 9 Scott 2023-08-16 16:00:51 PDT
13 years. Think they going for some sort of bug existence record with this one.
Comment 10 Antoine Quint 2024-01-25 04:12:45 PST
The issue here is that WebKit and Chrome both trigger a _new_ transition for font-size on #inner on each animation frame as the #outer value changes. I will have to check the correct behavior here per spec.
Comment 11 Antoine Quint 2024-01-25 04:16:18 PST
Created attachment 469546 [details]
Testcase with logging

Attaching a new testcase which logs how transitions are started. It shows three different behaviors:

Firefox: single transitionstart event for both #outer and #inner going from 16px to 32px

Safari: single transitionstart event for #outer going from 16px to 32px and one transitionstart event for #inner per frame showing how we try to interpolate from the last interpolated value from the parent to the newly interpolated value until the parent's transition completes.

Chrome: single transitionstart event for #outer going from 0px to 0px and several, but fewer, transitionstart event for #inner from 0px to 0px. There's clearly a bug in Chrome with getKeyframes() in this instance.
Comment 12 Antoine Quint 2024-01-25 07:23:33 PST
I think the Firefox behavior is correct (on top of being rather clearly what the author would expect). Here's the relevant spec text, from https://drafts.csswg.org/css-transitions-1/#starting:

"Likewise, define the after-change style as the computed values of all properties on the element based on the information known at the start of that style change event, but using the computed values of the animation-* properties from the before-change style, excluding any styles from CSS Transitions in the computation, and inheriting from the after-change style of the parent."

When the "triggered" CSS class is applied and font-size changes to 2em on the #outer element, I interpret this spec text as having these effects:

1. for #outer this would mean the after-change style is 2em, which computes to 32px
2. for #inner, the after-change style will inherit from the #outer after-change style, and thus be 32px

As such both elements should transition together from 16px to 32px.