babel-plugin-inline-react-svg
babel-plugin-inline-react-svg copied to clipboard
Adding aria-hidden attribute fails
Hello, I'm trying to implement this plugin but it's failing on the following configuration:
{
name: 'addAttributesToSVGElement',
params: {
attributes: [
{
fill: 'currentColor',
},
{
'aria-hidden': true,
},
],
},
},
This produces a console error:

I also tried this configuration which produces the same thing:
{
name: 'addAttributesToSVGElement',
params: {
attributes: [
'fill="currentColor"',
'aria-hidden="true"',
],
},
},
I've taken a look at https://github.com/airbnb/babel-plugin-inline-react-svg/issues/33 and https://github.com/airbnb/babel-plugin-inline-react-svg/issues/42 which are both marked as fixed by https://github.com/airbnb/babel-plugin-inline-react-svg/pull/43 but I'm still seeing the issue present, although its no longer transforming to ariaLabel rather I believe the problem lies in the fact that its trying to use 'aria-label' as the attribute.
Is my configuration incorrect? Or is this an actual issue?
What about ariaHidden?
@ljharb that produces the following:

What about:
attributes: [
{
fill: 'currentColor',
'aria-hidden': true,
},
],
@ljharb that produces the same error as the original screenshot.