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

Added appropriate labels to checkboxes in Cache File page table for accessibility #111

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

coffeeologist
Copy link
Collaborator

Issue

Resolves #101
Refer to the original issue specification with the link above.

Solution idea

  • Tables like this cache file page are generated through a generic template, so our solution also adhere to this dynamically generated method and change the template, instead of hardcoding labels.
  • Google lighthouse checks for visible (ie not hidden) label elements that either encapsulates the form (our checkboxes), or directly references the form's id. In order to not disrupt the original appearance of the page, a fix must come from using an existing resource as labels (since you cannot add the hidden attribute to labels). In our cache file list, the 2nd column contains the label of the cache locations.

Implemented solution

The template is changed to condition on the column's name (it's name must be "Label"), and turns the original table entry <a..>label text></a> into a label: <label for="checkbox_n"><a>...</a><label>. Where checkbox_n is assigned based on the checkbox's order in the table.

This is what a rendered table's elements look like (note that values like "Assets cache" are dynamically provided, and all I did was change the template in which data was fed into.
code

End result

The lighthouse score for the accessibility component has now risen from 82 to 89, with form labeling issue completely resolved.
afterfixing

label

Google lighthouse cannot detect hidden labels, which is what I had
before. Instead, in order to not disrupt the original appearance of the
table, I decided to use the existing Labels column's href column values
to be the labels.
@coffeeologist coffeeologist changed the title Feature/form checkbox label Added appropriate labels to checkboxes in Cache File page table for accessibility Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[File cache list] The checkbox elements do not have associated labels for accessibility tools
1 participant