-
Notifications
You must be signed in to change notification settings - Fork 28
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
One line fix for accessibility issue #33
Conversation
Are there any downsides here? Does this now make all code snippets "steal focus" if someone starts tabbing and they all have scrollable regions? Are there cases where someone might want |
If a codebox does not have a scrollbar, tabbing will skip it. If a codebox does have a scrollbar, you will tab to the box and be able to use the arrow keys to scroll in the box. It doesn't steal focus, it is just inserted into the list of tab-able items in the DOM.
It may be possible that someone would want to modify the value of this, or any attribute. If you want to support that usecase I would suggest <template>
<highlightjs
language="xml"
code="<h1>Hello world</h1>"
:pre-attributes="{
title: 'Example',
style: 'border: 10px solid blue'
}"
:code-attributes="{
title: 'Example',
focusable: 'focusable',
tabindex: '10000'
}"
/>
</template> But even if you do allow for setting/overriding attributes, I would still say this PR should be merged as is, so that the |
Ah, right. In that case this seems a reasonable default.
Yeah, I was forgetting the behavior of 0... |
@joshgoebel So can this be merged and added as a release? I'm currently reaching in via a |
Please add a changelog entry and we'll get this merged. (this repo is looking for a maintainer, it's not official part of HLJS anymore) |
Updated the changelog, let me know if anything else is needed. |
This change allows you to tab to the code box when a scrollbar appears. Making the scrollbar keyboard accessible.
This fixes the following issue:
Essentially if there is a code block with a line of code so long that it breaks the box, then a
overflow: auto
scroll bar will appear, but keyboard users need to be able to TAB to the element and scroll it. If no scrollbar appears, the element is be skipped during tabbing, like usual.More details: