Skip to content

fix(a11y): avoid plain divs as button or tabs#6084

Merged
haileyok merged 4 commits into
bluesky-social:mainfrom
cyyynthia:fix/a11y-roles
Nov 3, 2024
Merged

fix(a11y): avoid plain divs as button or tabs#6084
haileyok merged 4 commits into
bluesky-social:mainfrom
cyyynthia:fix/a11y-roles

Conversation

@cyyynthia

Copy link
Copy Markdown
Contributor

This PR improves accessibility by turning skeet controls (Translate, Reply, Reskeet, Like, Share, More) actual buttons instead of divs with an event handler.

Same with tabs such as on profiles, they are now properly marked as tabs for assistive technologies to pick up.

Closes #4409

cyyynthia and others added 3 commits November 2, 2024 20:01
…te...)

Signed-off-by: Cynthia Rey <cynthia@cynthia.dev>
Signed-off-by: Cynthia Rey <cynthia@cynthia.dev>

@haileyok haileyok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! Made a small tweak, will merge after I test it works...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might not be something we address in this PR but shouldn't the web implementation use a literal button element rather than relying on an aria role?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

React Native is quite smart here and makes it use a literal button on web (this also applies to the other places where a role has been added).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, I see. That's great to know 😄

hoverStyle={pal.viewLight}
onPress={() => onPressItem(i)}>
onPress={() => onPressItem(i)}
accessibilityRole="tab">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are there any tab panels we can associate with these tabs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ideally the panel views would be associated with the tabs (as tabpanels with aria-labelledby), but I didn't feel confident adding it (and afraid it'd require adapting multiple places where the component is used); so I kept it simple.

FWIW, not associating a tabpanel is not a violation of the WAI-ARIA specification -- it's a should -- and should not be an issue so long the semantics of the page still allow assistive technologies to let the user navigate. It's best practice to associate them, but getting rid of clickable plain divs is already a huge step up. 😅

I think (am pretty sure) there are many accessibility nits and issues throughout the app, so properly doing the association could be handled in future improvements

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agreed, it's definitely nice to get some semantics in there without having to do a huge refactor 👍 would be nice to eventually have it all hooked up.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yea there's definitely a ton of problems that we are slowly fixing up. Lots of debt that has to get cleaned up along the way...these PRs are super helpful in getting that debt cleaned up (I honestly didn't even realize this particular problem!)

@haileyok

haileyok commented Nov 3, 2024

Copy link
Copy Markdown
Member

Verified the tweak I made works, really appreciate you cleaning these problems up 🙏

@haileyok haileyok merged commit ac9d910 into bluesky-social:main Nov 3, 2024
@cyyynthia cyyynthia deleted the fix/a11y-roles branch November 3, 2024 18:00

@SleeplessByte SleeplessByte left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I know this was merged, and definitely an improvement. I did leave a comment about something I ran into just now.

</NewText>

<NewText
<InlineLinkText

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This should not be a link but a button.

The label is not necessary and adding it will actually break translation (e.g Google Translate) as it will not translate the aria-label.

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.

can't navigate to replies/reposts/likes buttons within keyboard on pc via some browser extensions

4 participants