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

Show file status tooltip on keyboard navigation #17192

Merged
merged 12 commits into from Aug 9, 2023

Conversation

sergiou87
Copy link
Member

xref. https://github.com/github/accessibility-audits/issues/4938

Description

In #17144 we added the file status to the aria label of our file list items. However that won't be of any use for keyboard-only users that don't use screen readers. Inspired by the work done in #16487, this PR attempts to improve the experience for those users by automatically showing a tooltip over that icon when those list entries get the focus via keyboard interaction.

Compared to #16487, where the tooltip is shown no matter how the changes list header obtained the focus, in this case we will only do that for keyboard interaction because otherwise it gets excessively noisy when the user clicks on these files.

In order to detect when a row gets focused via keyboard, I had to use some heuristics and detect some key events before and after being focused. It's not absolutely perfect, I'm sure of that, but should be enough for our purposes.

Screenshots

Screen.Recording.2023-08-08.at.10.02.22.mov

Release notes

Notes: [Fixed] Improve readability of file statuses for keyboard-only users

@sergiou87 sergiou87 requested a review from tidy-dev August 8, 2023 08:03
Copy link
Contributor

@tidy-dev tidy-dev left a comment

Choose a reason for hiding this comment

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

✨ Works great!

I really like how you narrowed it to keyboard focus so it less noisy for mouse users.

@sergiou87 sergiou87 merged commit 81be848 into development Aug 9, 2023
7 checks passed
@sergiou87 sergiou87 deleted the file-status-tooltip branch August 9, 2023 06:31
@koenpunt
Copy link
Contributor

I think this change broke how you can select files to commit using spacebar, because now when pressing spacebar it checks and immediately unchecks the checkbox.

}

private onRowKeyUp = (e: React.KeyboardEvent<HTMLDivElement>) => {
this.props.onRowKeyDown(this.props.rowIndex, e)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be calling this.props.onRowKeyUp?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, you're right 😭 Nice catch!

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.

None yet

3 participants