Static HTML elements like <div> and <span> have no semantic meaning.
When adding interactive event handlers to these elements, you should provide a role attribute to convey their purpose to screen readers, search engine crawlers, and other technologies that rely on semantic elements.
Semantic HTML elements like <button> already have appropriate roles and don’t need additional attributes.