Provide an accessible label for the combobox in the compact category list #141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When you view the homepage or a Category page with a sufficiently narrow screen, you get a combo box to choose a different category page to go to.
This combobox doesn't have an accessible label. NVDA + Firefox currently announce the combobox as:
I've reworded 'Categories' to 'Category', on the grounds that the user should choose a single 'category' not multiple 'categories'. And I've re-marked-upped it from a
<h3>
to a<label>
which is explicitly associated with the combo box using thefor
attribute. I've also sprinkled in a bit of CSS so that the visual appearance is almost identical. Here's what it looks like:The top margin is subtly different, but I think there's no obvious need for that subtly different top margin that would justify an extra line of CSS. Happy to be overruled if you disagree!
Now, the combo box is announced by NVDA + Firefox as:
This should be generally in line with user expectations. Compare, for example, this location combo box from the footer in the BBC iPlayer website:
This is read out as:
This clears two errors identified by pa11y. Here's a screenshot where I run pa11y on the live blog and get two errors, but when I run the same pa11y command on my localhost version of the blog running on this branch, the errors go away.