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

Addition: inert attribute mappings #410

Merged
merged 16 commits into from
Mar 28, 2023
Merged

Addition: inert attribute mappings #410

merged 16 commits into from
Mar 28, 2023

Conversation

scottaohara
Copy link
Member

@scottaohara scottaohara commented May 31, 2022

closes #295

add inert attribute and mappings.

wondering if these need to call out that subtree elements should not be focusable re: their mappings, or if the comment here is sufficient? any other input on additional mappings that may need to be called out here are welcome.


Preview | Diff

closes #399
closes #295

add `inert` attribute and mappings.

wondering if these need to call out that subtree elements should not be focusable re: their mappings, or if the comment here is sufficient?  any other input on additional mappings that may need to be called out here are welcome.
@scottaohara
Copy link
Member Author

Note: I've been drafting updates to the HTML spec for the inert subtree/attribute section. I will reference that here when the PR is made.

Copy link
Contributor

@spectranaut spectranaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions :)

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
@scottaohara
Copy link
Member Author

@spectranaut thank you for the review

@scottaohara
Copy link
Member Author

cc @cookiecrook and @jcsteh for feedback and anything else you think needs to be called out in this spec for inert? Please see the companion HTML PR for inert that incorporates your feedback into that specification.
whatwg/html#8122

@zcorpan
Copy link
Member

zcorpan commented Feb 18, 2023

Hmm, so aria-hidden=true make the whole subtree be hidden, even if a descendant has aria-hidden=false (like CSS display: none). Maybe we need something in ARIA that is akin to CSS visibility, which can be hidden on an element and a descendant can still be shown with visibility: visible, to property define a mapping for inert?

Edit: or at least a spec hook to do so, which html-aam can use to explain modal dialog in an inert subtree.

@zcorpan
Copy link
Member

zcorpan commented Feb 18, 2023

Demo of modal dialog inside <div inert>:
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/11311

In Chrome, Safari, Firefox, the button "show (in inert div)" is not clickable, but the "close" button in the modal dialog is.

@JAWS-test
Copy link

In Chrome, Safari, Firefox, the button "show (in inert div)" is not clickable, but the "close" button in the modal dialog is.

On Windows I get a different result: in Firefox both buttons are clickable and the inert area is fully passed to the Accessbility API

@zcorpan
Copy link
Member

zcorpan commented Feb 21, 2023

Sorry, I meant Firefox Nightly. (inert is not yet enabled on release because this spec change is not yet implemented, see https://bugzilla.mozilla.org/show_bug.cgi?id=1767561 )

What I mean to show with the demo is that a modal dialog should itself be not-inert, even if it has an ancestor with an inert attribute.

index.html Outdated
Comment on lines 4267 to 4269
<p>A `dialog` element can escape an inert subtree when the `dialog` is in the modal state, and rendered in the browser's
<a href="https://fullscreen.spec.whatwg.org/#top-layer">top layer</a> by use of the `showModal()` method.
See also <a data-cite="html/interaction.html#modal-dialogs-and-inert-subtrees">Modal dialogs and inert subtrees</a>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How should a <div role="dialog"> or a <div role="menu"> achieve the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly by using the popover attribute, though i don't believe that functionality is available right now. we should open an issue for that separate from this.

Copy link
Collaborator

@cookiecrook cookiecrook Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I read it, popover is not intended for modals like <div role="dialog" aria-modal="true">. The Dialog API is the only option for a modal. Regardless, I agree that's addressable as a separate issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, ARIA would need a way of unhiding a child, see #410 (comment)

I can file a spec issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You had filed one already :) w3c/aria#1256

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm now confused what you mean with your first message in this thread.

Copy link
Member Author

@scottaohara scottaohara Mar 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dialog is the only element, when shown as a modal, which can escape its parent inert element and become re-exposed in the top layer.

so, per James's question, there is presently no way for someone to invoke an accessible ARIA dialog (modal or otherwise), or a menu if someone wanted to trap focus/screen readers in those elements, if it was contained within an inert container.

though popover is not allowed for HTML modal dialogs, the attribute does send an element to the top layer, so my mention of the attribute is that it could be a way for someone to do something like:

<div inert> <!-- attribute added when nested button is activated -->
  <button aria-haspopup=menu ...>
     invokes menu and sets parent to inert
  </button>
  <div role=menu popover ...> 
     <!-- menu items here and even though within an inert container, 
             since its in the top layer now, it COULD now be accessible --> 
   </div>
</div>

somewhere in some github thread that i've since lost track of, when implementation of inert was still being discussed, I had mentioned it would be great if inert=false would un-inert a child node of an inert parent. I don't understand the rational as to why that wasn't entertained further, other than potential implementation complexity. But back to James's original question, because of that decision there is no way to do what James was asking with HTML now, and aria-hidden=false wouldn't/shouldn't be expected to be a way to achieve this, as even if it did re-expose a part of the inert content, by itself it wouldn't undo the browser preventing click/focus to go to the aria-hidden=false content (as applicable if it were to consist of actionable elements)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marking this thread as unresolved just to make sure this related discussion about inert/aria-hidden=false isn't missed by those being directed to this issue.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be great if inert=false would un-inert a child node of an inert parent

Coming in very late, and obviously this has no bearing on the outcome of this PR, but I talked a bit about the rationale here: https://www.igalia.com/chats/alice-and-rob (you can search for "one way" in the transcript rather than listen to the whole rambling conversation).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alice thank you for the link and background!

@scottaohara
Copy link
Member Author

scottaohara commented Mar 3, 2023

@zcorpan per your previous comment

Edit: or at least a spec hook to do so, which html-aam can use to explain modal dialog in an inert subtree.

with linked example and

What I mean to show with the demo is that a modal dialog should itself be not-inert, even if it has an ancestor with an inert attribute.

to my understanding that's already specified in HTML 6.3.1 Modal dialogs and inert subtrees - reference in this PR. So i don't think we need anything else?

Re: your example contains a button and the dialog in the inert subtree, the dialog is spec'd to escape it. "subject escapes inertness of ancestors" so that's why the button, and its contents are accessible.

followed on by the note

The dialog element's showModal() method causes this mechanism to trigger, by adding the dialog element to its node document's top layer.

again, per my response in the comment thread with James, HTML could leverage this to allow popovers to also escape inert, since they too go to the top layer. But per your example and the button that invokes such elements being within an inert parent - this would likely require the topic of inert=false to be re-opened.

Edit: however i also realize i may be reading way too much into the note and what "this mechanism" really means. but if i'm wrong, maybe that could use some clarification?

@zcorpan
Copy link
Member

zcorpan commented Mar 8, 2023

I think the HTML spec is correct about which nodes are inert and which are not, but this PR mapping the inert attribute to aria-hidden=true (which makes the element itself and all of its descendants hidden in the a11y tree) doesn't match the HTML spec because it means a descendant modal dialog (which should be uninerted) is still hidden in the a11y tree.

More correct would be to say something like "Nodes that are inert are not exposed to an accessibility API. Note: an inert node can have descendants that are not inert (e.g. a modal dialog element in HTML). Note: This is similar to aria-hidden, except aria-hidden=true will unconditionally hide all descendants."

@scottaohara
Copy link
Member Author

scottaohara commented Mar 8, 2023

@zcorpan re:

Note: an inert node can have descendants that are not inert (e.g. a modal dialog element in HTML).

will that be true for any other element aside from modal dialogs? my understanding is that's not true right now, and per my mention of inert=false not being entertained, is this actually something that would happen?

Seems the PR could either be updated to specifically mention that if an element (a modal dialog) escapes being inert, then it should no longer be considered aria-hidden=true. Or, the PR is further adjusted to be more inline with your suggestion that inert doesn't directly map to aria-hidden=true, but it and its subtree behave similarly, but descendants of an inert parent can be marked as not inert - e.g., a modal dialog.

@cookiecrook @aleventhal thoughts on the above? and specifically, are there any other platform mappings we'd need to note here if the attribute isn't just referring to aria-hidden's mappings in core aam?

@cookiecrook
Copy link
Collaborator

I think Simon's normative suggestion and first note are correct:

Nodes that are inert are not exposed to an accessibility API. Note: an inert node can have descendants that are not inert (e.g. a modal dialog element in HTML).

But I would not include the second note:

Note: This is similar to aria-hidden, except aria-hidden=true will unconditionally hide all descendants.

As that may change further with w3c/aria#1256 and the implementations don't currently align on that statement either.

@zcorpan
Copy link
Member

zcorpan commented Mar 9, 2023

@scottaohara it might be true in the future if we introduce other ways to escape inertness.

@scottaohara
Copy link
Member Author

@cookiecrook @zcorpan thank you both. i'll work on getting this updated.

should we actually update the ARIA spec to mention inert in https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion

that seems it might be a good place for a longer explanation of how to handle inert / potential children which are no longer inert, which could then be linked to from html aam / other aams which might need it.

index.html Outdated Show resolved Hide resolved
@scottaohara scottaohara merged commit 4f3c8b2 into gh-pages Mar 28, 2023
@scottaohara scottaohara deleted the inert-mapping branch March 28, 2023 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inert subtrees mapping
6 participants