maxeth / react-type-animation

A React typewriter animation based on typical with extended functionality and customization.

Home Page:https://react-type-animation.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forward role attribute

openscript opened this issue · comments

commented

Thank you for your work on this package!

I've followed your accessibility guide and added a aria-label. If we add an aria-label also a role should be added:

image

So I suggest to also accept a role prop and forward it to the created wrapping element.

commented

Hey,

I don't think setting an aria-label is the optimal solution, because – as your error message suggests — it's intended to be used on interactive elements that are supposed to be accessible via assistive technologies.

Since such an animation is for decorative purposes and has 0 interaction, I think the only proper role for it would be "presentation", and in that case, all ARIA semantics will be automatically removed from the element, including aria-label, similarly to just setting a css display none.

So if you set an aria-label, it would contradict with setting the component's true role "presentation", since this role erases the meaning of the aria-label.

At this point I'd just go with the visually-hidden class if you want to get rid of the lighthouse warnings.


Regarding your feature request: Which role do you think would be meaningful for this component? If it's presentation or none, then passing the role prop would do nothing as described above.

Added in react-type-animation@3.2.0.