expressive-code / expressive-code

A text marking & annotation engine for presenting source code on the web.

Home Page:https://expressive-code.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unnecessary tab index on pre elements?

fflaten opened this issue · comments

The audit feature in Astro dev toolbar says tabindex=0 doesn't belong on the <pre>-elements. Thoughts?
image

Do we need it to be focusable or is the copy button enough? Doesn't look like CTRL+C works on <pre> focus either way. Any other benefits? Relevant if scrollable maybe?

The attribute is intentional. According to our a11y testing, the attribute is required for screen readers to properly read the code. The warning is therefore incorrect and can be ignored.

Thanks for the quick response. Found a relevant discussion for reference 🙂

Thank you for linking this! I wanted to look it up as well and didn't find it quickly. :) Here's another one that I remember as well: withastro/astro#8001 (Edit: Just saw that it was also linked in the discussion you posted!)

I'm not sure if we can do anything to avoid that supposedly incorrect flagging of the attribute by the toolbar. If more users report this in the future, we might need to investigate further.

The audit appears to be smart enough that it doesn't flag elements with overflow (and therefore a scrollbar).