The button element is incredibly versatile and benefits from good a11y when used correctly. However, the current default styling creates all sort of issues that makes <button> not feasible in most cases. The alternative is to resort to a[href="#"] with role="button" plus extra event listeners to handle the keyboard interaction.
(*) Non-link buttons are HTML constructs such as span.pointer that pretend to be buttons but do not fully behave like those.
The button element is incredibly versatile and benefits from good a11y when used correctly. However, the current default styling creates all sort of issues that makes
<button>not feasible in most cases. The alternative is to resort toa[href="#"]withrole="button"plus extra event listeners to handle the keyboard interaction.<button>..buttonclass to all elements that should continue to look like a button.Converta[href="#"]into<button>, this includes stripping extrakeydownevents that are no longer required.Convert non-link buttons (*) into<button>.(*) Non-link buttons are HTML constructs such as
span.pointerthat pretend to be buttons but do not fully behave like those.