just-the-docs icon indicating copy to clipboard operation
just-the-docs copied to clipboard

Fix `aria-pressed` value in `button.nav-list-expander`

Open mattxwang opened this issue 1 year ago • 1 comments

In the following code snippet, the aria-pressed value is hardcoded:

https://github.com/just-the-docs/just-the-docs/blob/0fc476871ca2dac5504cf5522f8955332af20b18/_includes/components/nav.html#L49

With a cursory glance, I don't think this is always the correct aria-pressed value: the only JS that could toggle the aria-pressed value is:

https://github.com/just-the-docs/just-the-docs/blob/0fc476871ca2dac5504cf5522f8955332af20b18/assets/js/just-the-docs.js#L27-L37

Which only triggers on-click. If the expander is already open, the "pressed" value for the toggle would still be false. In contrast, if the expander is already open, the pressed value should be true!

It may also be worth better researching if aria-pressed is the appropriate aria-role here (is the expander, strictly speaking, a "toggle button"?).

Ref: https://github.com/just-the-docs/just-the-docs/pull/1431/files#r1579206339.

mattxwang avatar Aug 19 '24 22:08 mattxwang

Oops! The permalink now no longer works with main (as expected, since the file moved). Here's the new relevant snippet:

https://github.com/just-the-docs/just-the-docs/blob/8292f46be932b13cba1301dfa8ce914d5f72627e/_includes/components/site_nav.html#L50

I'll try to get this in the second/third accessibility pass I do (likely whatever becomes 0.11.0, with the bigger accessibility changes, color scheme changes, etc.)

mattxwang avatar Sep 09 '24 19:09 mattxwang