Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an accessible label for the combobox in the compact category list #141

Merged

Conversation

jcarstairs-scottlogic
Copy link
Contributor

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.

A screenshot of the combo box on the current live blog

This combobox doesn't have an accessible label. NVDA + Firefox currently announce the combobox as:

clickable combo box Latest Articles collapsed

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 the for attribute. I've also sprinkled in a bit of CSS so that the visual appearance is almost identical. Here's what it looks like:

A screenshot of the combobox after this PR

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:

Category combo box Latest Articles collapsed

This should be generally in line with user expectations. Compare, for example, this location combo box from the footer in the BBC iPlayer website:

A screenshot of the location combo box from the footer in the BBC iPlayer website

This is read out as:

Change location combo box East Yorks & Lincs collapsed

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.

Screenshot of pa11y finding two errors with the live blog which are resolved with this PR

@ColinEberhardt ColinEberhardt merged commit 4089dec into ScottLogic:gh-pages Dec 14, 2023
1 check passed
@jcarstairs-scottlogic jcarstairs-scottlogic deleted the fix/category-select-accessible-name branch December 14, 2023 14:10
dsmithsl pushed a commit to dsmithsl/blog that referenced this pull request Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants