Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definition of "owned" is not strict enough; should actually be direct children, not any descendant #748

Open
jnurthen opened this issue May 8, 2018 · 18 comments
Assignees
Labels
bug clarification clarifying or correcting language that is either confusing, misleading or under-specified
Milestone

Comments

@jnurthen
Copy link
Member

jnurthen commented May 8, 2018

From - https://www.w3.org/Bugs/Public/show_bug.cgi?id=26307

The definition of "owned" in the ARIA spec includes any descendant (or any descendant of a node that's aria-owned).

That means that according to the spec, it's okay to have a list with listitems that are descendants but not direct children, or a grid with rows that are descendants but not direct children, e.g.:

<div role="list">
  <div>
    <div role="listitem">One</div>
  </div>
  <div>
    <div role="listitem">Two</div>
  </div>
</div>

<div role="grid">
  <div>
    <div role="row">
      <div>
        <div role="gridcell">1, 1</div>
      </div>
      <div>
        <div role="gridcell">2, 1</div>
      </div>
    </div>
  </div>
</div>

In practice, this doesn't seem to work with any browser or screen reader, unless you use aria-owns or role=presentation.

It occasionally works in some circumstances when the browser skips over extra unneeded container elements - but it definitely doesn't work in general.

Either the spec needs to better match how browsers and assistive technology have implemented their support for owned relationships, or browsers need to start doing a lot of extra work to search all descendants for required owned elements.

@jnurthen
Copy link
Member Author

@jnurthen jnurthen added this to the ARIA 1.2 milestone Mar 16, 2019
@jnurthen jnurthen added the bug label Mar 16, 2019
@jnurthen
Copy link
Member Author

@WilcoFiers - does this cover it?

@jnurthen
Copy link
Member Author

Proposal:
Fix owned element language to restrict owned elements to

  • Direct Children
  • Elements referenced with aria-owns
  • Descendant elements where each ancestor node between the parent and the element has a role of none or generic

Should we also allow

  • Descendant elements of the element referenced with aria-owns where each ancestor node between the element referenced with aria-owns and the owned element has a role of none or generic

(need to make this language completely unambiguous - this is a first proposal and needs work)

@accdc
Copy link

accdc commented Mar 18, 2019

Clarification is good, but this is a thorny one, because this restriction has the potential to break ARIA menus and trees and listboxes where additional markup is almost always used in the wild for styling purposes.

E.G what if the intervening markup includes LI elements that are not presentational?

I agree this has never worked reliably before, but browsers should be capable of at the very least to process explicit role associations and identify in which order interactive constructs include their parent child role associations. I know this is doable, because I already had to do this as part of the AccName algorithm code to get it to work right.

@jnurthen
Copy link
Member Author

@accdc it would be helpful to provide an example which a change like this would break. This change would actually be slightly more generous than the current level of support by allowing generic containers which don’t work reliably today I believe.

@accdc
Copy link

accdc commented Mar 19, 2019

Sorry, not that the change would break anything, just that if the logic wasn't inclusive enough it would leave those constructs out of the computation.

E.G I've seen constructs like this in the wild.

<div role="tablist">
<ul>
<li>
<a role="tab" aria-selected="true" tabindex="0" href="#"> One </a>
</li>
<li>
<a role="tab" aria-selected="false" tabindex="-1" href="#"> Two </a>
</li>
</ul>
</div>

At present, browsers primarily ignore the computed child tabs so the child count such as "x of y" is typically "1 of 1" when encountered by screen readers. The same thing happens for radios, listboxes, and likely others.

Algorithmically though, within browsers, it is possible to compute the explicit role assignments and compute an accurate role hierarchy without having to nullify all intervening markup, since technically such as in this case, list and listeitem roles as these implicitly are, are not generic. The same is true for many other standard HTML elements that might be unexpectedly combined in these ways.

@jnurthen
Copy link
Member Author

jnurthen commented Mar 19, 2019

As this doesn't currently work today we have 2 options:

  • try to get the browsers to allow this
  • make the spec clear that this is not allowed.

As authors have a way of making this work in my proposal by using role=none on the ul, I personally lean towards speccing the current browser behavior and moving on.

@accdc
Copy link

accdc commented Mar 19, 2019

Adding this to the spec sounds fine to me, though I recommend adding that, in cases where role="none" is not added, then aria-posinset and aria-setsize must then be set upon relevant roles to ensure proper accessibility for supported widgets.

@accdc
Copy link

accdc commented Mar 19, 2019

And before you say it, because you are probably thinking it, if role='none' is added then they don't have to use those attributes... :)

One big issue with the 'broad-strokes' approach is that framework devs will start adding role="none" to everything just to play it safe. I've already seen this in production environments, and it breaks everything.

@joanmarie joanmarie removed the Agenda label Apr 3, 2019
@joanmarie
Copy link
Contributor

Another issue which came up: What about the scenario where there are no children? For instance, what if an author has a need to do something like <div role="list"></div> because they have a need to expose an empty list? In that case, I think we have two choices:

  • Remove the current required owned elements (listitem and grouplistitem)
  • Modify the definition of "required owned elements" to indicate that they are required when the element in question has children

My vote is for the latter.

@rdeltour
Copy link
Member

Note that this issue potentially impacts the DPUB ARIA extension, which currently relies on the required context role being an ancestor, not the direct parent (in the semantic tree, i.e. no-role elements being ignored).

For instance, doc-biblioentry is a subclass of listitem and is intended to be used as a list child:

Authors MUST ensure that elements with role doc-biblioentry are contained in, or owned, by an element with the role list

but is also specifying a required context role of doc-bibliography, which is itself a landmark.

See the markup example 7 of DPUB ARIA 1.0:

<section role="doc-bibliography">
   <h1>Select Bibliography</h1>
   <ul>
      <li role="doc-biblioentry" id="faulkner-dying">
         William Faulkner, As I Lay Dying (New York: Jonathan Cape & Harrison Smith, 1930)
      </li>
   </ul></section>

@joanmarie
Copy link
Contributor

Meta comment regardless of the direction we take: I suspect that we will get some pushback from user agents if we normatively require (MUST) them to sanity-check the new, more strict language. If we want to be able to ship things, I think we'll want to SHOULD the user agents and MUST the authors. That way, validators can complain loudly.

@jnurthen jnurthen removed the Agenda label Aug 21, 2019
@mattgarrish
Copy link
Member

Note that this issue potentially impacts the DPUB ARIA extension

Late to the party after being away for a couple of weeks, but, yes, it effects cleanup we'd have to do to the specification to properly align with the new requirement, but it's not a breaking change.

We wanted to establish that bibliography entries are expected inside a bibliography section (and term/def inside a glossary), but not having that as an ownership requirement shouldn't be an issue. It sort of happens logically, anyway.

@jnurthen jnurthen modified the milestones: ARIA 1.2, ARIA 1.3 Nov 19, 2019
@joanmarie
Copy link
Contributor

Potentially related: We have language which says things like:

Authors MUST ensure elements with role treeitem are contained in, or owned by, an element with the role group or tree.

Does that mean a treeitem must be a direct child of a group or tree, or any descendant? Regardless of the answer, perhaps we can also clarify what "contained in" means as part of this fix?

@MelSumner
Copy link
Contributor

<div role="list">
  <div>
    <div role="listitem">One</div>
  </div>
  <div>
    <div role="listitem">Two</div>
  </div>
</div>

I wonder if allowing this would be confusing, since the equivalent in semantic HTML is not valid?

Example (this is invalid):

<ul>
  <div>
    <li>One</li>
  </div>
  <div>
    <li>Two</li>
  </div>
</ul>

@stes-acc
Copy link

stes-acc commented Sep 11, 2020

Currently validators (for some lugubrious reasons) don't apply always the same strict nesting rules for markup with ARIA as for plain HTML.

There are many other examples.

@scottaohara
Copy link
Member

scottaohara commented Sep 11, 2020

@MelSumner per your test cases, i created this codepen to show how these patterns are interpreted by jaws/nvda/vo/talkback
https://codepen.io/scottohara/pen/gOrzrmJ

support has actually improved in some cases, even from a few months ago where invalid nesting / severing the direct parent child relationship between the list/list items would cause more instances of significant issues than i'm finding (though some of those still did occur).

@jnurthen
Copy link
Member Author

jnurthen commented Oct 1, 2020

#1033 related

@pkra pkra added this to To do in Owned Elements etc Feb 27, 2021
@spectranaut spectranaut added this to Mel Summer in ARIA 1.3 Jun 7, 2022
@spectranaut spectranaut added the clarification clarifying or correcting language that is either confusing, misleading or under-specified label Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug clarification clarifying or correcting language that is either confusing, misleading or under-specified
Projects
ARIA 1.3
Mel Sumner
Development

No branches or pull requests

9 participants