Skip to main content

Website Techniques

A foundational principle of web accessibility is to prioritize standard, semantic HTML over complex custom components. Standard elements are inherently accessible and require less effort to implement correctly.

For example, a standard <button> is accessible by default, while a custom <div> acting as a button requires significant additional attributes and scripting to replicate the same functionality.

Custom control:

<div role="button" tabindex="0" onclick="event.preventDefault(); doSomething()" onkeydown="if(event.keyCode==13 || event.keyCode==32) { event.preventDefault(); doSomething(); }">Custom Button
</div>
Last modified