Repository navigation
Accessibility fixes for screen reader and keyboard users - #1380
Merged
Merged
Conversation
Tweet action spans (reply, retweet, like, bookmark, more) now have
role=button, are reachable with Tab, work with Enter/Space and get an
aria-label that includes the count ("Reply, 3"). Like, retweet and
bookmark expose aria-pressed. Also covers search filters (aria-pressed),
profile tabs and navbar links (aria-current), time links (full date
as label), textareas (placeholder kept as label), the character counter
(announced at 20 left, 0 left and over the limit) and one polite live
region for announcements.
Also fixes the retweet tooltip showing (L) instead of (T).
createModal now marks the content as a modal dialog, moves focus into it, gives the close control a button role and a Close label, and returns focus to where it was when the modal closes.
The bar is now a focusable button with the number of new tweets in its label. When a person presses it, focus moves to the first new tweet and the count is announced. Automatic timeline updates don't move focus.
One h1 per page: sidebar titles are now level 2 and the numbers and labels in the profile card are no longer headings. Home, Notifications, Search and Tweet pages get a visually hidden h1. Profile pictures in the sidebar card and the top bar get labels, the top bar avatar works as a menu button from the keyboard, and Messages gets an href so it is reachable with Tab.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I use VoiceOver and I really like OldTwitter, but a lot of it is hard to use with a screen reader right now. For example, the reply, retweet and like buttons are spans with no name, so VoiceOver just reads "0 0 0" and I can't tell which is which or press them from the keyboard. This PR fixes that and some other things. I tried to keep every change small and not change how anything looks.
What changed
How it works
Most of this is in one new file, scripts/accessibility.js, injected with the other page scripts. It adds the roles, labels and states and keeps them updated with a MutationObserver, so I didn't have to touch every place that builds or updates a tweet. It also adds one polite live region for the announcements. The rest are small edits: createModal in helpers.js, the new tweets button in layouts/home, heading attributes in the layout HTML, and a hidden-text class in header/style.css. New strings are only in the English locale, and other languages fall back to English like they already do.
Testing
Suggestions (not in this PR)