-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Make scrollable code boxes accessible by keyboards #296
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
Conversation
Screen Recording (Ubuntu, Chrome): simplescreenrecorder-2022-11-02_12.17.09.mp4Also tested in Firefox (Ubuntu), Safari (MacOS) |
Finally fixed the issue on MacOS+Chrome simplescreenrecorder-2022-11-14_16.19.08.mp4 |
@anurbol |
Unfortunately no, it prevents it from getting focus at all. |
Can we try to make this new div have the width and height as the parent container and make use of z-index to move it behind the text elements. |
I think this can't be done with CSS alone, but with the help of javascript. So it probably starts looking like an overkill. |
@arisacoba a fix is made to make a text box with horizontal scrollbar to be able to scroll while using keyboard. When the element is focused it looks as below, is it ok to proceed with? |
@amit-avit Done here. Tried to make it as simple as possible... still doesn't look very nice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks much better even though a bit more complex.
LGTM
BTW you tagged wrong amit
in ur comment 😁
@anurbol @amit-avit best to cross-post this concern with |
Fair enough, created a thread https://github.slack.com/archives/C03RM57QL64/p1668668686952059 |
Hi! Trying to review this using the instructions in the README but |
@lindseywild You can make use of this preview URL : https://npm-f9a17b3f5d-15913497.drafts.github.io/, it has the changes that are made in this PR |
Thank you for this! It's a lot better than what is currently there, which doesn't work at all, so I like it! I realize that this isn't entirely elegant due to the constraints of the third-party code. I was able to test this on Chrome with a keyboard, Safari with a keyboard + VoiceOver, and NVDA + Chrome. NVDA reads "blank" when tabbing to the code example, but I'm not sure if that can be easily fixed... It doesn't prevent the user from doing anything, it's just a little odd. To cover our bases, if you could open an issue in the third-party library stating that keyboard functionality doesn't work for scrollable boxes, that'd be great -- that will allow us to close the audit issue even with a few quirks. Thanks! |
Awesome thank you |
Previously there was no way to access code boxes by keyboard, and this was a problem for the scrollable ones.
Fixed it by making code lines focusable, so whenever they get focus the wide code block can be scrolled to the right and left by right and left arrow keys.
This might be considered as a hackish workaround, or not so much, but it's the cleanest option I found. It must be said that the code block is rendered by a 3rd party highlighting component, so we are a bit limited in solutions.
References
Related to https://github.com/github/accessibility-audits/issues/2746