I'm doing a react component which is an SVG animation. The react component's code is something like this:
const Loading = ({ className, ...props }) => {
return (
<svg
aria-label="animated block"
width="32"
height={"32"}
className={className}
{...props}
>
<rect x="1" y="0" width="19" height="8" opacity="0.4" rx="5">
<animate
id="anim1"
attributeName="width"
from="19"
to="8"
begin="0s;anim2.end"
dur="0.3s"
/>
<animate
id="anim2"
attributeName="width"
from="8"
to="19"
begin="anim1.end"
dur="0.3s"
/>
</rect>
</svg>
)
}
When showing a page with more than one of these, the accessibility linters show me the error "id attribute value must be unique".
Is there any way to avoid this error?
I've tried using aria-hidden
both in the svg
element and in each animate
element, but with no success.