Skip to content
Advertisement

What should be role value of div in html after apply onclick on div

What should be the value of the role attribute when I apply onclick to a div. I read the documentation WAI-ARIA Roles, but not able to find any specific role value of a div. I am working in React and this component is inside a loop, on this component I have to go to another page when clicking on this component. What should be the value of the role attribute, If I do not use the role attribute then ES-Lint gives me a warning which is not acceptable.

Advertisement

Answer

On rereading your question, EDIT: since you are performing a navigation : role ="link".

For actions, you need role="button"

But, try to use the correct semantic whenever possible.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement