Disable HTML Elements - Orange Digital Accessibility Guidelines

  1. Home
  2. Articles
  3. Disable HTML elements
On this page Disable form elementsDisable a link Disable HTML elements Associated themes :
  • Web
  • Beginner
July 01, 2021

Disable form elements #

The disabled attribute is used to disable form elements

<button disabled>Delete</button> <input type="text" name="address" disabled>

If a <fieldset> is disabled, the descendant form controls are all disabled.

<fieldset id="group" disabled> <input name="foo"> <input type="checkbox" name="bar"> <select name="values"> <option value="1">Value 1</option> <option value="2">Value 2</option> <option value="3">Value 3</option> </select> </fieldset>

To disable a link, unlike the previous technique, the use of the disabled attribute is not allowed. It is still possible to disable a link by following 3 steps:

  • remove the href attribute so that it can no longer receive the focus
  • add a role="link" so that it is always considered a link by screen readers
  • add an attribute aria-disabled="true" so that it is indicated as being disabled
<a role="link" aria-disabled="true"> Disabled link </a>

Check out Scott O'Hara's excellent article on the subject: Disabling a link.

On this page

  • Disable form elements
  • Disable a link
Back to top Anchor link

Từ khóa » Html A Tag Disabled