Skip to content

Attribute support: aria-labelledby #43

@chipcullen

Description

@chipcullen

Per the summary:

Handles namespaced attributes (xlink), and other non-react attributes/tags, on component mounting, so the returned jsx will compile cleanly with babel.

One issue that we are running into, however, is using the aria-labelledby attribute. When authoring SVGs, this attribute can be used on the root <svg> element to aid screenreaders correctly announce what the SVG is supposed to be. Example usage:

<svg viewBox="0 0 126 126" xmlns="http://www.w3.org/2000/svg" aria-labelledby="close__title">
  <title id="close__title">
    Close
  </title>
  <path d="..." />
</svg>

(More background on this can be found on Tip #3 here)

React handles the aria-labelledby attribute just fine when the SVG is pasted directly into JSX - but, when loaded via svg-react-loader you get this console error:

Unknown props `ariaLabelledby` on <svg> tag. Remove these props from the element.

Would it be possible to amend SVG react loader to handle aria-labelledby, in addition to the other attributes it handles?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions