Open Bug 1882408 Opened 1 year ago Updated 8 days ago

transition-behavior doesn't work as expected

Categories

(Core :: CSS Transitions and Animations, defect)

Firefox 125
defect

Tracking

()

Tracking Status
firefox125 --- affected

People

(Reporter: sebo, Assigned: boris)

References

(Depends on 1 open bug)

Details

(Keywords: parity-chrome, parity-safari)

Given the Codepen example provided by the people behind the related web.dev blog post, transition-behavior doesn't have any influence on the transition of the display property.

According to CSS Display 4, any p value between 0 and 1 results in the non-none value. So the cards in the example should have a value of block for the display property for the time of the transition (0.25s) until it switches to none.

Sebastian

Assignee: nobody → boris.chiou
Severity: -- → S3

Looks like the animation of display is buggy, per our meta.

I'd go through it for CSS Animation as well.

So it seems like we intentionally disabled the animation of display property, per Bug 1371518 comment 0. So this may be related to supporting animation for display property. Once we support it, transition-behavior should work properly.

We probably have to fix Bug 1834877 first.

Depends on: 1834877

Here's a feature-detect, if anyone needs it:

const supportsDisplayTransition = (() => {
  let cachedValue = undefined;
  return () => {
    if (cachedValue === undefined) {
      const div = document.createElement('div');
      div.style.transition = 'display 1s allow-discrete';
      document.body.append(div);
      const cs = getComputedStyle(div);
      cs.display;
      div.style.display = 'none';
      cachedValue = cs.display !== 'none';
      div.remove();
    }
    
    return cachedValue;
  };
})();

Thanks Jake!

It's sad that there's still no support for one of the main use cases for transition-behavior and also that the CSSWG missed to add a dedicated @supports keyword for that (see the related resolution for that). So authors have to rely on a JS solution for this.

Sebastian

For reference, I've now filed https://github.com/w3c/csswg-drafts/issues/13387 to discuss whether an @supports keyword should be added for that.

Sebastian

You need to log in before you can comment on or make changes to this bug.