File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
1416As we aim to improve accessibility, we encourage the use of aria-current for
1517styling 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
1936The aria-current attribute is easily styled with CSS using attribute selectors,
You can’t perform that action at this time.
0 commit comments