The "role" attribute in HTML is used to define the purpose or type of an element, mainly to help assistive technologies (like screen readers) better understand and communicate the structure and function of web content to users with disabilities. It describes what an element is or what it does, even if that’s not obvious from its HTML tag. For example, you can use `role="button"` on a `div` to tell assistive tools that it should be treated like a button.
Last Updated: April 27, 2025