Gutenberg: SVG icons: restore attributes required for accessibility

Created on 23 Aug 2018  Â·  3Comments  Â·  Source: WordPress/gutenberg

8916 changed many SVG icons, hardcoding them instead of using the Dashicon component. Thus, all the new icons now miss a few HTML attributes that are required for accessibility:

  • role="img" aria-hidden="true" to ensure they're hidden from assistive technologies
  • focusable="false" to work around an IE 11 bug where all the SVG icons within focusable elements are considered by IE focusable themselves, so there's the need to press the Tab key twice when navigating using the keyboard

I'm not sure what are the plans for all these hardcoded SVG icons. For sure, using the Dashicon component was ideal to standardize all the default props and rendered HTML attributes. If these new icons are going to stay hardcoded across the codebase (which I see less ideal), then there's the need to add to all of them the missing attributes.

Accessibility (a11y) [Type] Bug [Type] Regression

Most helpful comment

Of course it would be great to make sure these attributes are present also in icons provided by plugins 🙂

All 3 comments

For icons which we expect to be developer-provided (e.g. block icons), should we _anticipate_ that they could forget these attributes† and try to correct them programmatically?

_† Painfully obvious given the "Regression" label_ 😉

Of course it would be great to make sure these attributes are present also in icons provided by plugins 🙂

Fixed it in PR linked above.

Though worth noting this doesn't fix it for all plugin blocks in the future. Is the solution documentation, or JS wizardry? For now though, I'd think that would be a separate (though worthwhile) consideration from this ticket.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mtias picture mtias  Â·  83Comments

melchoyce picture melchoyce  Â·  169Comments

afercia picture afercia  Â·  73Comments

afercia picture afercia  Â·  78Comments

DeveloperWil picture DeveloperWil  Â·  102Comments