Intent to Prototype: :local-link pseudo selector.

114 views
Skip to first unread message

Keith Cirkel

unread,
Sep 30, 2024, 7:40:38 AMSep 30
to blin...@chromium.org

Contact emails


Explainer


Specification


Summary

The :local-link pseudo-class allows authors to style hyperlinks based on the users current location within a site. It represents an element that is the source anchor of a hyperlink whose target’s absolute URL matches the element’s own document URL. If the hyperlink’s target includes a fragment URL, then the fragment URL of the current URL must also match; if it does not, then the fragment URL portion of the current URL is not taken into account in the comparison.


Blink component


Motivation

It's common to style the active page in a list of links differently the others to denote the user is on such a page. This typically requires maintaining such state in the host language, such as the server side template language, or in the client. `:local-link` provides a browser built-in solution to this.


Initial public proposal


TAG review

None

TAG review status

Pending

Risks



Interoperability and Compatibility

None



Gecko: No signal

WebKit: No signal

Web developers: Positive

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Is this feature fully tested by web-platform-tests?

No

Flag name on chrome://flags

Experimental Web Platform Features

Finch feature name

None

Non-finch justification

None

Requires code in //chrome?

False

Estimated milestones

No milestones specified



Link to entry on the Chrome Platform Status

PhistucK

unread,
Sep 30, 2024, 8:09:36 AMSep 30
to Keith Cirkel, blin...@chromium.org
If the hyperlink’s target includes a fragment URL, then the fragment URL of the current URL must also match
That sounds strange and less desired to me, as even if it has a fragment, it is still on the same page. But maybe the use case is using the fragment part for navigation in a single page application? I have seen that being used less and less.

PhistucK


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ad994a5a-8966-449d-a0e1-2f46086e4bc2%40app.fastmail.com.

Jeffrey Yasskin

unread,
Sep 30, 2024, 12:57:15 PMSep 30
to PhistucK, Keith Cirkel, blink-dev
I've filed https://github.com/w3c/csswg-drafts/issues/10975 to question the current naming. Regardless, the use case seems valuable and worth prototyping. Thanks for working on it!


Reply all
Reply to author
Forward
0 new messages