Good Code
The good version uses a native button, which already participates in keyboard interaction, focus order, and accessibility APIs.
Lesson 08
Use native controls for actions so interaction behavior comes with the element.
<button type="button" aria-pressed="false">
<!-- Native buttons bring keyboard and focus behavior with them. -->
Save draft
</button><div class="button" onclick="saveDraft()">
<!-- A clickable div must recreate button behavior by hand. -->
Save draft
</div>The good version uses a native button, which already participates in keyboard interaction, focus order, and accessibility APIs.
The bad version may be styled to look identical, but the generic div has to recreate expected button behavior by hand.