-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add tabindex to highlight template func markup #7194
Comments
You can copy this into your project: |
Never mind that comment, I see that the shortcode is just delegating to the internal template func. |
The internal function wraps the code in a div tag. hugo/markup/highlight/highlight.go Lines 88 to 92 in f0266e2
Would it be possible to move this to the short code?
That way users have more flexibility in wrapping the generated |
Hey again, I was thinking of this again since #8280 with attribute lists for code fences. Would it be possible to have a way to specify default attributes for code fences? |
Browsers like Firefox will allow scrollable elements to be tab focusable by default, so maybe it's a browser-level issue? I've been injecting tabindexes with Edit: Oh yeah. And while using tabindex, Firefox is the one complaining about accessibility. 🤣 (Even tho it works fine.) By forcing tabindex in ALL elements (even if not scrollable), the issue becomes "Focusable elements should have interactive semantics". |
Currently the generated `<pre>` element isn't fully accessible as it can't be focused by keyboard users. To make this fully accessible, the attribute `tabindex="0"` should be added to the `<pre>` tag. Closes #7194
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Code blocks generated through the
{{ highlight }}
shortcode or through the use of Markdown code fences should have thetabindex="0"
attribute, allowing them to be tab focusable. This is good for accessibility; see here.I've searched through the docs and I cannot find any way to set this attribute myself in my own site, since the
highlight
shortcode is (apparently) built-in to Hugo, so I don't think there is any way to do this outside of a change to Hugo itself.The text was updated successfully, but these errors were encountered: