Re: [csswg-drafts] Exposing navigation/route matching (#12594)

> Some quick questions/feedback:
> 
> * I see `<route-with-params>` defined, but it’s not used anywhere in the snippet. Do you have an example?

Oops, fixed

> * I see you’re trying to capture “a route matches” and “a navigation { from x / to y / from x to y }” both under `@route`. Maybe this should be split up into `@route` and `@navigation`?

It's something to consider! Though the thing is that a route itself can be a "navigation". A route is a rule, not a particular current URL.

> * I don’t understand the explanation “a matching route is in the element's scope” for the `#some-element:route(<route-query>)` example.

It's explained [here](https://github.com/WICG/declarative-partial-updates/blob/main/route-matching-explainer.md). Route rules can be either document or element scoped, kind of like language/direction.

So the following would work:

```html
<section id=dashboard>
   <script type=routemap>[{"name": "main", "route": "/dashboard"}]</script>
</section>
<section id=settings>
   <script type=routemap>[{"name": "main", "route": "/settings"}]</script>
</section>
``` 

An element styled `something:route(main)` would work differently in the dashboard section and in the settings section because they have separate route maps. 

This allows defining how URLs map to UI in a more local way without having to think about the whole document's namespace.

Note: like with view-transitions, planning to have this as an enhancement after we get document-scoped routing done, but wanted the design to take that into account.

> * Shouldn’t `:link(<route-query>)` be `:link([<route-name> || <route-name-with-params>])`?

I fixed that, yes.

> * I still would like to be able to define routes in just CSS, withou the need for the routemap script.

OK.


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


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

Received on Wednesday, 3 September 2025 20:13:39 UTC