I'm trying to make a form accessible. Should I make my inputs have both disabled
and aria-disabled
attributes, or just one?
<label for="textbox1">Input</label>
<input id="textbox1" type="text" name="Text Box" disabled>
Or like this?
<label for="textbox1">Input</label>
<input id="textbox1" type="text" name="Text Box" aria-disabled="true">
Or like this?
<label for="textbox1">Input</label>
<input id="textbox1" type="text" name="Text Box" aria-disabled="true" disabled>
I can take your example, put it in a CodePen, and check it in JAWS and NVDA (sorry, no VoiceOver today):
You will be happy to know that both NVDA and JAWS skip the field (or if explicitly focused, announce that is disabled).
In short, you do not need
aria-disabled
any longer. Just usedisabled
.You can read a bit more about the ARIA attributes you can dump in this article by Steve Faulkner (one of the editors of the ARIA spec) from 2015 (though
aria-disabled
is not explicitly listed, the concept is the same): http://html5doctor.com/on-html-belts-and-aria-braces/If my answer looks similar to your other question about
required
versusaria-required
, that is because it is essentially the same answer.An important distinction is that when using voice-over the item with just the 'disabled' property will not be tabbed to. However the item with aria-disabled="true" will still be able to receive focus and report to the screen reader as dimmed.
To complete @aardrian answer.
When you use an HTML control which supports natively the
disabled
attribute, you do not need thearia-disabled
attribute.If you use a custom control then you can use the
aria-disabled
attribute. For instance, in the following code, the "Pause" button will be disabled until the "Play" button is pressed (our javascript will then changetabindex
andaria-disabled
attributes).Note that according to W3C: