Skip to content

[view-transitions-1] Have the -image-pair, -old, and -new pseudos inherit animation-timing-function #11546

Closed

Description

@bramus

(This issue is basically a copy of #9817 adjusted to be about animation-timing-function instead of animation-delay.)

I just caught myself doing this in a project I’m working on:

:root::view-transition-image-pair(*),
:root::view-transition-new(*),
:root::view-transition-old(*) {
  animation-timing-function: inherit;
}

I needed to do this to sync up the animation-timing-function from the ::view-transition-group(x) to its child-pseudos.

::root:view-transition-timing-function(header) {
  animation-timing-function: linear(…);
}

Without the first code snippet my animations were not in sync: the default fade-in/fade-out on the new/old pseudo runs at a different curve.

I was surprised that animation-timing-function: inherit; on the pseudos isn’t part of the UA stylesheet VT styles, especially since the VT UA styles do exactly that for animation-duration + animation-fill-mode + animation-delay:

/* UA Stylesheet (selection) */
:root::view-transition-group(*) {
  … 

  animation-duration: 0.25s;
  animation-fill-mode: both;
}

:root::view-transition-image-pair(*) {
  …

  animation-duration: inherit;
  animation-fill-mode: inherit;
  animation-delay: inherit;
}

:root::view-transition-old(*),
:root::view-transition-new(*) {
  …

  animation-duration: inherit;
  animation-fill-mode: inherit;
  animation-delay: inherit;
}

I think it would be handy to include animation-timing-function: inherit for the -image-pair, -old, and -new pseudos in the UA stylesheet so that setting a timing-function on the -group automatically gets applied on the the child pseudos as well, keeping them all in sync.

Activity

  1. bramus commented on Mar 19, 2025

    @bramus
    ContributorAuthor

    In an internal discussion it came up that we should probably inherit all animation longhand properties, save for the animation-name. Adding animation-iteration-count could work, but personally I am not too sure about animation-direction and animation-play-state.

  2. vmpstr commented on Mar 20, 2025

    @vmpstr
    Member

    I'd prefer we deal with them on a case-by-case basis. animation-timing-function makes sense though.

  3. vmpstr commented on Mar 27, 2025

    @vmpstr
    Member

    Separately, as you mentioned, we should maybe also inherit animation-play-state. Just ran into a testing issue where we missed the fact that new/old cross faded while we were trying to have the whole thing paused

  4. css-meeting-bot commented on Jun 25, 2025

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [view-transitions-1] Have the `-image-pair`, `-old`, and `-new` pseudos inherit `animation-timing-function` , and agreed to the following:

    • RESOLVED: Make animation-timing-function, -iteration-count, -direction, -play-state inherit in the VT tree
    The full IRC log of that discussion <TabAtkins> fantasai: We inherit some of the animation properties thru the VT tree, so you only have to specify it on -group
    <TabAtkins> fantasai: so they'll all sync up their animations
    <TabAtkins> fantasai: Bramus brought up that animation-timing-function should also inherit for the same reason.
    <TabAtkins> fantasai: makes sense to me
    <flackr> +1 sgtm
    <TabAtkins> astearns: looks like Vlad wasn't sure about inheriting *everything*, but a-t-f made sense to them
    <TabAtkins> fantasai: also mentioned were iteration-count and play-state. flackr probably has an idea of whether those make sense
    <TabAtkins> fantasai: and direction
    <TabAtkins> astearns: should we resolve on all four, or just the timing function?
    <TabAtkins> flackr: maybe it makes sense to inherit all of them on VT, since they're related
    <TabAtkins> flackr: i'd support all four, if we find one doesn't make sense we can revisit
    <TabAtkins> PROPOSED: Make animation-timing-function, -iteration-count, -direction, -play-state inherit in the VT tree
    <TabAtkins> astearns: objections?
    <TabAtkins> RESOLVED: Make animation-timing-function, -iteration-count, -direction, -play-state inherit in the VT tree
  5. added a commit that references this issue on Jul 18, 2025
    3d13816
  6. deleted a comment from danowar2 on Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions