Description
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:
- A name of the feature. The feature is something like "trigger a view transition on a navigation"
- Which navigations activate this rule?
- type of navigaiton: normal/back/forward/reload/jump.
- old/new URL (URL patterns, or keywords that represent them like "same-origin")
- potentially, same-document or cross-document navigation, though this would probably be defined in JS.
- Given these conditions, should the transition be triggered?
- 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!):
@view-transition { trigger: navigation }
(what we settled on temporarily in the TPAC resolution).@view-transition-behavior { trigger: navigation }
@navigation-behavior { view-transition: trigger }
@nav-transition { behavior: trigger }
@view-transition navigation(same-origin) { behavior: trigger }
@auto-view-transition { trigger: navigation }
@navigation-view-transition { behavior: trigger; }
@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;
}
}