Re: [csswg-drafts] [selectors] :local-link should have a more precise name (#10975)

Quoting @LeaVerou:
> Of which 1 is by far the most prevalent, followed by 2 and 3. For 4, I think we need to revisit use cases to see what the best syntax might be (e.g. maybe a way to match URLPatterns would work better). So I would suggest we focus initial efforts on 1 + 2 + 3 and maybe 5.

I'd agree with focusing on the first three cases, but I also agree with the selector naming concern of this bugreport, particularly as it affects in case 1:

> 1. Same origin + path + same fragment if page has a fragment + same query params (in any order) if page has query params

I'm aware of two very different usages of URL fragments on the web, and I think that the selector name needs to make clear to developers what the behaviour will be in both of these:

  * Single-page applications where different fragments indicate navigation to entirely separate logical views within the application.  In these applications, `webapp.html#/A/` typically presents the user with a separate view to to `webapp.html#/B/`, for example.  Because each view is loaded dynamically, web crawlers adapted to these web applications by [crawling their content differently](https://moz.com/blog/exploring-googles-ajax-crawling).

  * Basic HTML pages (including webpages that do not include any JavaScript) where a fragment references content entirely contained within the same document -- so `webapp.html#A` and `webapp.html#B` both refer to content that a user can find by scrolling up-or-down the page (no dynamic content loading is required to access the link target).

In both cases, the selector would allow styling one menu item out of, say, five menu links, where the single item refers to "what the user most recently clicked/selected in order to view content".

Due to this, I would vote _against_ the name `current-page`, because in the second use-case, the developer's mental model is likely to be of a single page containing multiple content blocks -- yet the styling only applies to hyperlinks to the most-recently-clicked content block.

Instead, I'd suggest the alternative name: `navigation-focused`.

As in (hypothetical):

> To color hyperlinks that refer to the selected view in the web application in green, add the CSS rule `a:navigation-focused { color: "green" }`.

Note: this is distinct from `:target` because it is a selector that applies based on `href`-matching (an element that refers to the browser navigation target), instead of `id`-matching (an element that is itself the browser navigation target).

-- 
GitHub Notification of comment by jayaddison
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10975#issuecomment-2440008674 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 27 October 2024 13:06:01 UTC