Architecture Decision Records (ADRs)

← Home

Use <button> and <a> tags appropriately

Introduction

It may seem harmless to use <a> and <button> tags interchangeably but to use them in their correct context provides accessibility benefits.

Decision

Use <a> tags for links only. Use <button> tags to trigger actions like toggling elements on/off, opening and closing content, or submitting forms.

Context

It’s ok to style links to look like buttons. The issue is when using <a> tags for toggling elements because we have to use javascript to prevent default behavior which leads to issues when javascript is disabled in addition to screen readers misidentifying the element.

Consequences

Exceptions

Additional Resources

None

← See more ADRs