Skip to content

Commit d554423

Browse files
noamrbramus
andauthored
[css-navigation-1] Change :trigger-link to :nav-source and include submit/form (#14122)
* [css-navigation-1] Change `:trigger-link` to `:nav-source` and include form/submit as well Resolution: #11801 (comment) Closes #11801 * Update css-navigation-1/Overview.bs Co-authored-by: Bramus <bramus@bram.us> --------- Co-authored-by: Bramus <bramus@bram.us>
1 parent 14685cd commit d554423

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

css-navigation-1/Overview.bs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -596,30 +596,35 @@ by matching the relevant parts of the navigation URL to the link URL.
596596
NOTE: Some of the design discussion for this feature has been in
597597
<a href="https://github.com/w3c/csswg-drafts/issues/13163">w3c/csswg-drafts#13163</a>.
598598

599-
<h3 id="trigger-link-pseudo-class">The '':trigger-link'' pseudo-class</h3>
599+
<h3 id="nav-source-pseudo-class">The '':nav-source'' pseudo-class</h3>
600600

601-
This specification defines a new
602-
<dfn id="trigger-link-pseudo" selector>'':trigger-link''</dfn>
603-
that matches link elements that trigger the current navigation.
604-
605-
The '':trigger-link'' pseudo-class matches any element where both:
606-
* the element matches '':any-link''
607-
* the [=current navigation state=] is not null, and element is its [=navigation state/source element=].
601+
This specification defines a <dfn id="nav-source-pseudo" selector>'':nav-source''</dfn> pseudo-class,
602+
matching the element that triggered the current navigation. It is a CSS reflection of the {{NavigateEvent/sourceElement}} property in the Navigation API.
603+
The trigger element can be an [^a^], [^area^], [^form^], a [^input/type/submit^] input, or a [^button^].
608604

609-
Issue: should this apply to forms or submit buttons?
605+
The '':nav-source'' pseudo-class matches any element <var>el</var> where
606+
the [=current navigation state=] is not null, and <var>el</var> is its [=navigation state/source element=].
610607

611608
<div class="example">
612609

613-
A simple example of a '':trigger-link'' selector is this one,
610+
A simple example of a '':nav-source'' selector is this one,
614611
which sets the ''view-transition-name'' for an image thumbnail that is a child of the link that triggers the current navigation.
615612

616-
617-
<pre highlight=css>
618-
:trigger-link .thumb {
613+
<pre highlight=css>``
614+
a:nav-source .thumb {
619615
view-transition-name: active-image;
620616
}
621617
</pre>
622618

619+
The '':nav-source'' pseudo-class can also be used for forms and submit buttons:
620+
621+
<pre highlight=css>``
622+
form:nav-source .submit,
623+
.submit:nav-source {
624+
outline: 3px solid green;
625+
}
626+
</pre>
627+
623628
</div>
624629

625630
<h2 id="conditional-navigation-queries">Conditional rules for navigation queries</h2>

0 commit comments

Comments
 (0)