0

I have a <select> element with several options, 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 options, 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 options 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.

pushkin
  • 9,575
  • 15
  • 51
  • 95
  • It sounds like you might be trying to convey more semantic meaning for the disabled option than is intended with the default behavior. You are trying to convey "something went wrong" when an option is disabled. That's not the intent of the disabled attribute. I'd be careful overloading what disabled means. If you need to convey "something went wrong", then you are probably right that you need a custom control. – slugolicious Mar 22 '18 at 22:16
  • @slugolicious Good point. I'll think on it. – pushkin Mar 23 '18 at 01:43

0 Answers0