Skip to content

fix(site): add tests and improve accessibility for useClickable #12218

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

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

Parkreiner
Copy link
Member

@Parkreiner Parkreiner commented Feb 19, 2024

Part 3 for the hooks milestone

Changes made

  • Updates useClickable to be much more compliant with WCAG guidelines
  • Adds test for useClickable
  • Adds warning about design issues with useClickableTableRow (see notes)

Notes

  • I really wanted to add a test for useClickableTableRow, but it turns out that even though it's trying to help with accessibility issues, it's actually causing more of them. I added this comment to the file:
    /**
     * @file 2024-02-19 - MES - Sadly, even though this hook aims to make elements
     * more accessible, it's doing the opposite right now. Per axe audits, the
     * current implementation will create a bunch of critical-level accessibility
     * violations:
     *
     * 1. Nesting interactive elements (e.g., workspace table rows having checkboxes
     *    inside them)
     * 2. Overriding the native element's role (in this case, turning a native table
     *    row into a button, which means that screen readers lose the ability to
     *    announce the row's data as part of a larger table)
     *
     * It might not make sense to test this hook until the underlying design
     * problems are fixed.
     */
    Just because fixing all this might require a more thorough rewrite throughout several parts of the codebase (figuring out the best way to have all the same functionality without breaking any WCAG requirements), I'm going to be punting this to a future PR.
  • For completion's sake, it feels like it'd be nice to make useClickable support the spinbutton role, but it's going to drastically alter the implementation, which doesn't feel worth it for something that we don't have a use case for right now. Added a comment about how it could make sense down the line, though

@Parkreiner Parkreiner requested review from a team, aslilac and Kira-Pilot and removed request for a team and aslilac February 19, 2024 23:48
@Parkreiner Parkreiner marked this pull request as ready for review February 19, 2024 23:48
@Parkreiner Parkreiner changed the title fix: add tests and improve accessibility for useClickable fix(site): add tests and improve accessibility for useClickable Feb 19, 2024
* announce the row's data as part of a larger table)
*
* It might not make sense to test this hook until the underlying design
* problems are fixed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about moving this into a ticket as well as a note in the milestone?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, just for documentation/visibility, I think that'd be best.
Wondering if we could use an accessibility milestone, too

Copy link
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems clean to me!

@Parkreiner Parkreiner merged commit 1d254f4 into main Feb 21, 2024
@Parkreiner Parkreiner deleted the mes/hook-test-revamps-3 branch February 21, 2024 15:59
@github-actions github-actions bot locked and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants