I have a <select>
element with several option
s, some of which are disabled.
<select id="sel" size="3">
<option value="a">A</option>
<option value="b" disabled>B</option>
<option value="c">C</option>
</select>
The disabled option
signals to the end user (who is sometimes a technical person troubleshooting things) that something went wrong. It shouldn't normally be disabled.
In an effort to make this accessible by JAWS and NVDA, we replaced disabled
with aria-disabled
, because disabled options
aren't focusable, so screen readers would never pick them up.
On top of enabling these option
s, we also applied some styling to gray them out and make them look disabled. This makes screen readers behave appropriately, but now, users are able to select these option
s which should be disabled, which introduces a UX problem.
.unavailable {
color: grey;
}
<select id="sel" size="3">
<option value="a">A</option>
<option class="unavailable" value="b" aria-disabled="true">B</option>
<option value="c">C</option>
</select>
It seems that the only way of solving this while keeping the current behavior is to implement our own custom select control that allows disabled options to be focusable (or something along those lines).
Barring doing that, what is the canonical way of handling this? It seems like screen readers can never pick up disabled options, so software with disabled options can never be fully accessible (in terms of screen readers)?
Is there a way to get the best of both worlds? An unselectable, greyed-out option
that can be picked up by screen readers.