-
Notifications
You must be signed in to change notification settings - Fork 54
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
Twoslash output is inaccessible #195
Comments
I don't know if it's an explicit project goal that Twoslash output must not include JavaScript, but the library currently relies entirely on CSS for functionality. As this issue outlines, that makes the content of tooltips inaccessible to users who navigate via keyboard or screen readers. How possible would it be to keep the current CSS-only foundation that is currently in place, but use the forthcoming Popover API to provide a more accessible experience in browsers that support it? There could be some challenges matching the hover behavior with the Popover API without additional JavaScript to implement imperative popover toggling, but 1) encoding the tooltips in the markup would support screen readers and 2) JavaScript would likely be necessary to support the roving |
I think this energy is probably worth putting into the new version of twoslash which might have more of a way to customize how the twoslash annotations are turned into HTML due to it being a shiki transformer: https://github.com/twoslashes/twoslash |
Ah, thank you! I missed the note in the README about the new repo. Moved my issue over to: twoslashes/twoslash#32 |
Hey there 👋 I noticed that currently TwoSlash produces inaccessible output.
This issue is not a comprehensive accessibility audit, but I wanted to draw attention to some key issues that would need addressing to make TwoSlash code blocks usable by more users.
The references here are to Web Content Accessibility Guidelines (WCAG) 2.2
Key accessibility failures
Guideline 2.1 Keyboard Accessible
Twoslash tooltips are only available via mouse/pointer hover, so fails most of WCAG Guideline 2.1 regarding keyboard accessibility: it should be possible for users to access the content of tooltips using only the keyboard.
Guideline 4.1 Compatible
Twoslash tooltips are not available to screen readers: navigating a code sample using Twoslash, there is no way for screenreaders to access the content of tooltips.
Other details
There are some smaller things like the following, but these are kind of moot given the bigger issues:
1.4.13 Content on Hover or Focus
Tooltip content is not dismissible via a mechanism other than moving the pointer’s hover position.
The text was updated successfully, but these errors were encountered: