🐛 Bug Report
Default role="img" introduced in #737 #750 is a breaking change and should be reverted/have opt-out.
Not a huge fan of this being defaulted in the way it was. While I appreciate the sentiment this is problematic since now this requires alt text/aria-labels or a role="presentational" override on every SVG output from SVGR (to my understanding, I could be wrong that a label would be required now - https://dequeuniversity.com/rules/axe/4.4/svg-img-alt?application=axeAPI).
Most of our usages of SVGs are for icons used in buttons that already configured for accessibility and the SVG doesn't need to be focusable or explained to the non visual user.
It would at the least be nice if we could opt-out of this default behavior, I noticed we do parse the svgProps but since that's a spread/merge it wont override if we set role to undefined to attempt to unset it.

In addition with further research seems like SVGs really shouldn't have their implict role blanket overridden with img as it is: https://www.unimelb.edu.au/accessibility/techniques/accessible-svgs#:~:text=SVG%20Roles,%3D%22graphics%2Dsymbol%22.
To Reproduce
Steps to reproduce the behavior:
@svgr/rollup >= 6.4.x, can view new role in snapshots
Expected behavior
A clear and concise description of what you expected to happen.
No default configuration for the role on SVG, if folks need that behavior they can already pass it in with the existing svgProps on the configuration. Or a way to opt out of this new behavior
Link to repl or repo (highly encouraged)
Please provide a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard
Paste the results here:
## System:
- OS: macOS 12.6
- CPU: (8) arm64 Apple M1 Pro
- Memory: 103.20 MB / 16.00 GB
- Shell: 5.8.1 - /bin/zsh
## Binaries:
- Node: 14.19.3 - ~/.nvm/versions/node/v14.19.3/bin/node
- npm: 6.14.17 - ~/.nvm/versions/node/v14.19.3/bin/npm
- Watchman: 2022.09.26.00 - /opt/homebrew/bin/watchman
## npmPackages:
- @svgr/rollup: 6.5.0 => 6.5.0
🐛 Bug Report
Default role="img" introduced in #737 #750 is a breaking change and should be reverted/have opt-out.
Not a huge fan of this being defaulted in the way it was. While I appreciate the sentiment this is problematic since now this requires alt text/aria-labels or a role="presentational" override on every SVG output from SVGR (to my understanding, I could be wrong that a label would be required now - https://dequeuniversity.com/rules/axe/4.4/svg-img-alt?application=axeAPI).
Most of our usages of SVGs are for icons used in buttons that already configured for accessibility and the SVG doesn't need to be focusable or explained to the non visual user.
It would at the least be nice if we could opt-out of this default behavior, I noticed we do parse the
svgPropsbut since that's a spread/merge it wont override if we set role toundefinedto attempt to unset it.In addition with further research seems like SVGs really shouldn't have their implict role blanket overridden with
imgas it is: https://www.unimelb.edu.au/accessibility/techniques/accessible-svgs#:~:text=SVG%20Roles,%3D%22graphics%2Dsymbol%22.To Reproduce
Steps to reproduce the behavior:
@svgr/rollup >= 6.4.x, can view new role in snapshots
Expected behavior
A clear and concise description of what you expected to happen.
No default configuration for the
roleon SVG, if folks need that behavior they can already pass it in with the existingsvgPropson the configuration. Or a way to opt out of this new behaviorLink to repl or repo (highly encouraged)
Please provide a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run
npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboardPaste the results here: