Closed miichu closed 2 years ago
Thanks for raising this issue.
The part of code where SVG is rendered can be seen here - https://github.com/palerdot/react-d3-speedometer/blob/438fa33e59ebfdfffb0db59753ec281419109b52/src/core/render/index.js#L61
Ideally, aria-labelledby
for SVG should be configurable via a prop
, for eg: svgAriaLabel
, so that people can configure what text should be added for aria-labelledby
. The default can be something like React Speedometer
.
May I fix this issue?
@logan4473
Feel free to raise a PR.
Please consider following pointers
svgAriaLabel
to configure SVG text (The default value can be React d3 speedometer
)role=img
, focusable=false
@palerdot
How should I add a prop svgAriaLabel
to configure SVG text?
Adding a new prop requires some involved changes and writing tests. I have outlined steps to add a new prop below.
DEFAULT_PROPS
(add all accessibility props at the last, with comment explaining that following props are related to accessibility) - around https://github.com/palerdot/react-d3-speedometer/blob/master/src/core/config/index.js#L67Please make sure to add a new test to verify if the aria-label
is showing correctly. Example tests can be referred here - https://github.com/palerdot/react-d3-speedometer/blob/master/src/tests/index.js#L88. Also, refer to enzyme documentation.
yarn lintfix
locally to lint the code as per this project requirements.Please allow edits from maintainers option for me to update docs if PR is in an acceptable state. Please refer - https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork
PS: Since this is an involved change, I'm removing the good first issue
tag
SVG Accessibility is released in v1.0.2
.
Example sandbox - https://codesandbox.io/s/magical-galileo-swf7e?file=/src/App.js
Hi!
When I run tests with the ARC toolkit in Chrome, I get these accessibility warnings.
To solve these errors and warnings, I was wondering if it was possible to add the attributes as described in the screenshot. I wanted to open a PR, however, I couldn't find the SVG to make the edits to. 🤔
I'll add an example of a fully accessible SVG.