w3c / aria

Accessible Rich Internet Applications (WAI-ARIA)
https://w3c.github.io/aria/
Other
631 stars 119 forks source link

Clarify whether aria-activedescendant may have a null value #1970

Open brennanyoung opened 1 year ago

brennanyoung commented 1 year ago

The spec for aria-activedescendant offers no guidance for what happens when there is no descendant (or owned) element to focus.

This may happen (e.g.) with a combobox under at least two distinct conditions:

Spec at https://www.w3.org/TR/wai-aria-1.2 does not recommend removing the attribute if it points at "nothing" (as it does with aria-errormessage) - this might imply that keeping it in the DOM (e,g, pointing at an empty string) is completely fine, but as it does not explicitly state that it is permitted, the ideal approach is not very obvious. I'd like this clarified unambiguously.

Does the issue exists in the editors draft (the editors draft is the most recent draft of the specification)? Apparently yes.

spectranaut commented 11 months ago

@mpaiva maybe this can be worked on with aria-controls?

mpaiva commented 11 months ago

I agree @spectranaut - we should add that to the language.

MarioBatusic commented 11 months ago

Agree. An other example is an empty listbox. We use for example listboxes for object lists and these can be empty. After creating one object list, it is always empty. So you have to put the focus on it and at these circumstances the focus stys exaclty here. The aria-activedescendant can only be "none" at this time.

mpaiva commented 11 months ago

I am not sure if anyone has already proposed a way to keep the parent element informed of its descendent existence, but I am thinking that a new attribute could be of help for these dynamic elements. I'd be willing to write a proposal for aria-pending.

aria-pending: This attribute could be used to indicate that a descendant element is pending or in the process of being mounted or created. It would inform parent elements, such as aria-controls or aria-owns, and assistive technologies that the descendant is not currently available but is expected to be added or become accessible in the future.

The aria-pending attribute could have Boolean values such as “true” or “false” to indicate the pending state of the descendant. When the descendant is finally mounted or available, the attribute could be updated to reflect the change.

@spectranaut - would you think this is viable?

MarioBatusic commented 11 months ago

I think that aria-busy put on the parent element has already the same functionality?

mpaiva commented 11 months ago

I think that aria-busy put on the parent element has already the same functionality?

Indeed. Thanks @MarioBatusic – this is helpful and I can add this approach in the proposed language changes for the aria-controls attribute.