w3c / accname

Accessible Name and Description Computation
https://w3c.github.io/accname/
61 stars 23 forks source link

The handling of multiple label elements on one form field is unclear #6

Open accdc opened 6 years ago

accdc commented 6 years ago

From the way that the naming computation is written, it is unclear what is meant to happen when more than one label element is associated with a form field, such as an implicit one that surrounds an input element, and another that has a matching 'for' attribute that references the ID of the same input element.

We need to standardize how this should be handled by browsers. Once this is done, I'll update the Accessible Name Computation Prototype with the expected behavior at https://github.com/accdc/w3c-alternative-text-computation so it can produce accurate test results when this is encountered.

The relevant thread recently discussed on the ARIA Working Group maillist follows.

-----Original Message----- From: Tobias Bengfort Sent: Monday, February 12, 2018 11:40 AM

Hi,

On 12/02/18 18:57, Bryan Garaventa wrote:

I don't understand what this means though: "This means that there can be more than one label for a labelable element. These labels should be processed in source order."

Are you referring to the DOM source order?

Do you mean that both of these would be treated differently and have different names?

As opposed to:

Because determining source order will be very expensive from a processing perspective and unreliable in practice because this could relate to anything such as use within data tables.

Yes, this is exactly what I mean. Note that it is not my personal opinion. This is defined in the HTML spec.

I can not really judge whether this is expensive or not. However, browsers have to implement this calculation for HTMLInputElement.labels anyway.

Tobias

-----Original Message----- From: Bryan Garaventa Sent: Monday, February 12, 2018 9:57 AM

No problem, I'll add one later today. I wasn't sure if this was a spec issue or an interpretation issue.

Tobias, I don't understand what this means though: " This means that there can be more than one label for a labelable element. These labels should be processed in source order."

Are you referring to the DOM source order?

Do you mean that both of these would be treated differently and have different names?

<label>
This is
<input id="lbl" />
</label>
<label for="lbl">a test</label>

As opposed to:

<label for="lbl">a test</label>
<label>
This is
<input id="lbl" />
</label>

Because determining source order will be very expensive from a processing perspective and unreliable in practice because this could relate to anything such as use within data tables.

xi commented 6 years ago

Relevant section of the HTML spec: https://www.w3.org/TR/html52/sec-forms.html#the-label-element

Labelable elements have a NodeList object associated with them that represents the list of label elements, in tree order, whose labeled control is the element in question. The labels IDL attribute of labelable elements, on getting, must return that NodeList object.

mcking65 commented 6 years ago

Assigned to 1.2 milestone because of the time required to determine:

  1. Is there already a clear "correct" approach based on the HTML spec.
  2. whether this should be resolved within the accname spec or if it dictates creating a dependency on the HTML spec.