Skip to content

[css-view-transitions-2] Decide on naming for navigation-triggered view-transition rule #9383

Closed
@noamr

Description

@noamr

For context, see TPAC discussion as well of the rest of the conversation at #8048.

The resolution was that we would have an at-rule that defines the relationship between a navigation and a view-transition - for start, it would allow you to specify that any same-origin navigation results in triggering a view transition.
The final naming was left open.

The at rule is supposed to be extended in the future to convey the following things:

  1. A name of the feature. The feature is something like "trigger a view transition on a navigation"
  2. Which navigations activate this rule?
    1. type of navigaiton: normal/back/forward/reload/jump.
    2. old/new URL (URL patterns, or keywords that represent them like "same-origin")
    3. potentially, same-document or cross-document navigation, though this would probably be defined in JS.
  3. Given these conditions, should the transition be triggered?
  4. What transition type names should be active?

To structure this all into an @ rule, it would look something like

@name-of-rule navigation-conditions { 
  should-be-triggered: yes | no;
  types: list of names;
}

The previous resolution led us to

@view-transition same-origin { trigger: navigation }

A few cons of the current resolution:

  • It seemed strange that "same-origin" applies to a "view-transition".
  • trigger: navigation might be confusing, as currently the trigger is only cross-document navigations. However, when we want to enable same-document navigation transitions in the future, we probably don't want to have to change all the CSS that applies to it.

Suggesting that:

  • The name should be distinct enough to be "the name of the feature", which describes something like "navigation-triggered view transition"
  • "same-origin" can be a default, and not a required keyword.
  • "cross-document" is still implicit.

Current suggestions (but open for more!):

  1. @view-transition { trigger: navigation } (what we settled on temporarily in the TPAC resolution).
  2. @view-transition-behavior { trigger: navigation }
  3. @navigation-behavior { view-transition: trigger }
  4. @nav-transition { behavior: trigger }
  5. @view-transition navigation(same-origin) { behavior: trigger }
  6. @auto-view-transition { trigger: navigation }
  7. @navigation-view-transition { behavior: trigger; }
  8. @navigation-view-transition { trigger: * } (where * means the default type)

If types are specified, it would look e.g. like @navigation-view-transition { behavior: trigger; type: slide-in; }

I am currently leaning towards (7) as it conveys that it's a distinct feature.

@navigation-view-transition {
   behavior: trigger;
}

which can later be extended to (for example):

@navigation-view-transition from "/article/" to "home" {
  behavior: trigger;
  type: slide-in;
}

@navigation-view-transition back {
  type: slide-reverse;
}

/* or combined, and overriden, e.g. with conditionals */
@navigation-view-transition back {
  behavior: none;
}

@media (max-width: 600px) {
  @navigation-view-transition back to "/article/" {
    behavior: trigger;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions