Good Code
The good version starts with native controls and uses ARIA only where the visible icon needs a clearer accessible name.
Lesson 10
Use native HTML first and add ARIA only when it describes behavior that HTML cannot express.
<button type="button">
<!-- Native buttons provide the role before ARIA adds only the missing label. -->
Save changes
</button>
<button type="button" aria-label="Close dialog">
x
</button><div role="button" aria-checked="true" aria-label="Submit">
<!-- ARIA roles and states conflict with the element behavior here. -->
Save changes
</div>
<span role="img" aria-label="Close dialog">x</span>The good version starts with native controls and uses ARIA only where the visible icon needs a clearer accessible name.
The bad version adds roles and states that do not match the elements or behavior, which can make the interface more confusing than plain HTML.