J.T. Houtenbos
J.T. Houtenbos

Reputation: 956

aria-describedby on containing div instead of input - usable?

Is it usable to put an aria-describedby on a div containing an input?

(Instead of just putting it on the input.)

<p id="description">Description of input</p>

<div aria-describedby="description">
  <input type="text">
  <input type="text">
  <input type="text">
</div>

Update:

As Steve Faulkner said below, this can be done by putting a role="group" and an aria-labelledby attribute on the div. This achieves basically the same thing as fieldset-legend would. The advantage is: You can seperate the "legend" from the "fieldset". If that is not necessary, it is probably best to stick with the regular fieldset-legend.

In the link below this technique is explained:

Using grouping roles to identify related form controls

If you want to make use of both description and a label ( with role="application" ), see link below:

Using the aria-describedby attribute

Upvotes: 1

Views: 1199

Answers (1)

Steve Faulkner
Steve Faulkner

Reputation: 2640

This will not work as expected, for a few reasons:

  1. a div element is generally not exposed in the accessibility tree so it presence (and it associated description string) will not be conveyed to the user
  2. refer to practical support for aria-describedby

Upvotes: 1

Related Questions