Skip to content

Commit cf5ab0a

Browse files
bartlomiejuclaude
andcommitted
docs: document query param matching and custom aria-current behavior
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e1b8274 commit cf5ab0a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

docs/latest/examples/active-links.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,27 @@ current page within a set of pages.
1010

1111
- `aria-current="page"` - Added to links with an exact path match, enhancing
1212
accessibility by indicating the current page to assistive technologies.
13+
- `aria-current="true"` - Added to ancestor links (e.g. `/docs` when the current
14+
page is `/docs/intro`).
1315

1416
As we aim to improve accessibility, we encourage the use of aria-current for
1517
styling current links where applicable.
1618

19+
### Query parameters
20+
21+
When a link's `href` includes query parameters, Fresh considers them during
22+
matching. A link to `/products?sort=name` will only receive
23+
`aria-current="page"` when the current URL also has `?sort=name`. If the query
24+
parameters differ, the link is treated as an ancestor instead. Links without
25+
query parameters in their `href` match regardless of the current URL's query
26+
string.
27+
28+
### Preserving custom `aria-current`
29+
30+
If you set `aria-current` on an `<a>` element yourself, Fresh will leave it
31+
untouched. This is useful when integrating with component libraries (e.g.
32+
daisyUI tabs) that manage their own active state.
33+
1734
## Styling with CSS
1835

1936
The aria-current attribute is easily styled with CSS using attribute selectors,

0 commit comments

Comments
 (0)