Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

Should you use a button instead of a clickable div?

Illustration without a description Illustration without a description

Use a native <button> when an element performs an action on the current page, such as opening a dialog, submitting a form or expanding a panel. A clickable <div> has no built-in button semantics or keyboard behavior. Styling requirements are not a reason to replace the native control.

 

A button is focusable in the expected tab order, announces its role to assistive technology and responds to both Enter and Space. It can expose disabled, pressed and expanded states through supported HTML or ARIA attributes. A generic div with a click handler normally works only for mouse or touch users unless the developer recreates all of these behaviors.

 

The preferred markup is simple:

 

<button type="button" aria-expanded="false" aria-controls="filters">
Show filters
</button>

 

Use a link instead when activation navigates to another page or resource. Buttons and links have different expectations: links open destinations and are normally activated with Enter, while buttons perform actions and also respond to Space. Matching semantics to behavior helps keyboard and screen-reader users predict what will happen.

 

If a legacy interface cannot immediately replace a clickable div, adding role="button" and tabindex="0" is still incomplete until keyboard events, focus styles, accessible naming and states are implemented. That solution carries more code and more ways to fail. Choose the native button first, reset its visual styles with CSS, and add ARIA only for state that HTML does not already express. Verify the final control with a keyboard, screen reader and forced-colors mode after applying custom styles.