mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-10 14:01:22 -06:00
This follows up from #1259 and closes #1261. Basically, this PR accomplishes the two items discussed in the issue: 1. for all anchors that are *actually* buttons (i.e., have `href="#"`), I've replaced them with a semantic `<button>` - under the hood, I've made a `.btn-reset` class pulling out the reset from #1259, so there's no visual change 2. for anchors that are ["toggle buttons"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role#toggle_buttons) (the mobile menu nav, sidebar children/grandchildren toggles), I've added an `aria-pressed` property that is updated as the button is clicked I've also slightly modified some of the `aria-label`s to make them more consistent. Observe that we *shouldn't* update these as the button is clicked; screen readers use the `aria-pressed` property to add an annotation to each button. To test this, - the sidebar children and grandchildren can be done on the deploy preview: - open an arbitrary page; observe that the sidebar children/grandchildren dropdown ticks now have a proper `aria-label` and `aria-pressed`, as well as otherwise work as intended - toggle one of the buttons; observe the `aria-pressed` role changing as this is done - open a grandchild page; observe that the `aria-pressed` has a correct default wrt whether or not the page is active - the mobile menu can be done on the deploy preview; on a smaller viewport, observe the correct `aria-pressed` - two features require local changes to test: - the `site.search.button` needs to be enabled in the `_config.yml`. To test this, locally clone the repo, change the flag, and observe that the button still works as intended + has no visual regressions. - the collections feature is a bit more complicated. To test this, locally clone the repo, add an arbitrary collection and changes to `_config.yml`, and observe the same behaviour for the sidebar children/grandchildren above