This solution reuses the existing copy and makes a minor change to the table generator.
A bonus to this approach is that tools like Google Translate translate regular text on the page, whereas they ignore attribute contents (like title or aria-label).
Further accessibility concerns
The solution I mentioned above is only helpful for screen reader users, which leaves an accessibility gap:
The title attribute on the icons only works for desktop users who can hover over the icon with a mouse. This leaves out mobile users and anyone who cannot hover or use a mouse (e.g., keyboard or speech recognition software users).
If you want to use tooltips, there should be other ways to trigger them (for example, by acting on keyboard focus, using toggle tips).
The last column of the rules table produced by crates/ruff_dev/src/generate_rules_table.rs is inaccessible:
scope
attribute.There is a
title
attribute on a span surrounding each icon, but title attributes do nothing accessibility-wise.Possible solution
A solution could be to use visually-hidden spans with descriptive text and hide the icons.
This code:
Could become this:
This solution reuses the existing copy and makes a minor change to the table generator.
A bonus to this approach is that tools like Google Translate translate regular text on the page, whereas they ignore attribute contents (like
title
oraria-label
).Further accessibility concerns
The solution I mentioned above is only helpful for screen reader users, which leaves an accessibility gap:
The
title
attribute on the icons only works for desktop users who can hover over the icon with a mouse. This leaves out mobile users and anyone who cannot hover or use a mouse (e.g., keyboard or speech recognition software users).If you want to use tooltips, there should be other ways to trigger them (for example, by acting on keyboard focus, using toggle tips).