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

Update "iframe with interactive elements is not excluded from tab-order" rule to manage inert iframe elements #2038

Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b59bcd3
Update programmatically-determined-link-context.md
giacomo-petri Jan 17, 2023
b041d85
Merge branch 'act-rules:develop' into develop
giacomo-petri Feb 23, 2023
63bd55f
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri Feb 23, 2023
9c05f21
Update programmatically-determined-link-context.md
giacomo-petri Feb 23, 2023
452504a
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri Feb 24, 2023
349c1e3
Create modal-dialog
giacomo-petri Feb 24, 2023
eb95290
Rename modal-dialog to modal-dialog.md
giacomo-petri Feb 24, 2023
149bca2
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri Feb 24, 2023
cc8411d
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri Feb 24, 2023
dc2ea72
Merge branch 'develop' into giacomo-petri-iframe-with-interactive-ele…
Feb 24, 2023
8a20cc5
Merge branch 'develop' into giacomo-petri-iframe-with-interactive-ele…
Mar 3, 2023
b3ca4c8
Apply suggestions from code review
giacomo-petri Mar 20, 2023
502f98b
Merge branch 'develop' into giacomo-petri-iframe-with-interactive-ele…
Jym77 Apr 27, 2023
f513178
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri May 8, 2023
ed2b5aa
Update and rename modal-dialog.md to inert.md
giacomo-petri May 8, 2023
a351297
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri May 8, 2023
aa22106
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri May 8, 2023
40e33e2
Update spelling-ignore.yml
giacomo-petri May 8, 2023
387b8df
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri May 8, 2023
32c5648
Update inert.md
giacomo-petri May 8, 2023
f8fd582
Apply suggestions from code review
giacomo-petri May 25, 2023
95b23ee
Update iframe-not-focusable-has-no-interactive-content-akn7bn.md
giacomo-petri May 25, 2023
2aba16d
Update inert.md
giacomo-petri May 25, 2023
eefecee
Merge branch 'develop' into giacomo-petri-iframe-with-interactive-ele…
Jym77 May 25, 2023
076278e
Merge branch 'develop' into giacomo-petri-iframe-with-interactive-ele…
Jym77 Jun 8, 2023
3d655f4
Apply suggestions from code review
giacomo-petri Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion _rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ acknowledgments:

## Applicability

This rule applies to any `iframe` element that [contains](#akn7bn:contain) at least one element for which all the following are true:
This rule applies to any `iframe` element that is not [inert](#akn7bn:inert) and that [contains](#akn7bn:contain) at least one element for which all the following are true:

- the element is [visible][]; and
- the element is part of the [sequential focus navigation order][] of the `iframe`'s [document][].

An element is <dfn id="akn7bn:contain">contained</dfn> in a [nested browsing context][] if its [owner document][] is the [container document][] of the [nested browsing context][].

An `iframe` element is <dfn id="akn7bn:inert">inert</dfn> if:
Copy link
Member

Choose a reason for hiding this comment

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

I think we can have this as a definition also, to make it reusable in other (future?) rules

Copy link
Member

Choose a reason for hiding this comment

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

And probably it would be better to have a definite of inert element, not just inert iframe

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree, we should have a separate definition of "inert element".

- it has an `inert` [attribute value][] of true; or
Copy link
Member

Choose a reason for hiding this comment

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

The attribute value doesn't matter. It just has to be present. Plus this should apply to ancestors too. Inert disables the entire subtree.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The attribute value doesn't matter. It just has to be present.

As per our definition of attribute value, boolean attribute (like inert) have an "attribute value" of true if the attribute is present.

giacomo-petri marked this conversation as resolved.
Show resolved Hide resolved
- an element which is not the iframe itself and that is not [contained](#akn7bn:contain) in it behaves as a [modal][], making the iframe inoperable.
Copy link
Member

Choose a reason for hiding this comment

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

What does "behaves as a modal" mean?
And do we want to tie this to the behaviour or the state? If there is a modal open, the iframe is inert and not applicable, but if the modal is closed, then the iframe is applicable. In both states, the component behaves as a modal, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can probably refer directly to the HTML definition of inert.
It doesn't refer explicitly to modals, but being blocked by a modal causes most of the document to be inert, so we can mention that.

If we want to have our own definition of inert, we should probably refer to "being blocked by a modal", since it is objective and unambiguous, and a common definition from higher spec.
This may leave room for custom modals where somebody uses a div and a ton of Javascript to turn it into a modal manually. We might be OK enough by having an assumption about people not being that crazy… (i.e. I do not know how frequent it is for devs to re-code modal behaviour on their own rather than relying on native semantics…)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- an element which is not the iframe itself and that is not [contained](#akn7bn:contain) in it behaves as a [modal][], making the iframe inoperable.
- an element which is not the iframe itself and that is not [contained](#akn7bn:contain) in it makes the iframe and all of its contents [inoperable][]. (For example: a modal.)

Does that improve the situation at all?

Copy link
Member

Choose a reason for hiding this comment

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

What I meant by modal dialogs was the actual <dialog> element with showModal() called on it. That programmatically makes all other content on the page inert. I think you could define it like this:

The element is in a page with a dialog element with the is-modal flag set to true, and is not a descendant of that dialog element.

I'm not sure we should try for a generic modal definition. I don't know how you'd do that in a way that's objective.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then, we are indeed going for blocked by a modal:

A Document document is blocked by a modal dialog subject if subject is the topmost dialog element in document's top layer. While document is so blocked, every node that is connected to document, with the exception of the subject element and its flat tree descendants, must become inert.

subject can additionally become inert via the inert attribute, but only if specified on subject itself (i.e., subject escapes inertness of ancestors); subject's flat tree descendants can become inert in a similar fashion.

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- an element which is not the iframe itself and that is not [contained](#akn7bn:contain) in it behaves as a [modal][], making the iframe inoperable.
- it is on the same page as a `dialog` element which has its [`is-modal`](https://html.spec.whatwg.org/multipage/interactive-elements.html#is-modal) flag set to `true`, and is not a descendant of that `dialog` element.


## Expectation

The test target does not have a negative number as a `tabindex` [attribute value][].
Expand Down Expand Up @@ -122,10 +126,32 @@ This `iframe` element contains a link that is not part of its [sequential focus
<iframe tabindex="-1" srcdoc="<a href='/' tabindex='-1'>Home</a>"></iframe>
```

#### Inapplicable Example 5

This `iframe` element is [inert][] because of its own `inert` [attribute value][].

```html
<iframe inert srcdoc="<a href='/'>Home</a>"></iframe>
giacomo-petri marked this conversation as resolved.
Show resolved Hide resolved
```

#### Inapplicable Example 6

This `iframe` element is [inert][] because of another element that behaves as a [modal][].

```html
<div style="width:100vw; height:100vh; position:absolute; left:0; top:0; background:#000; opacity: 0.8;"></div>
<div role="dialog" aria-labelledby="modal-heading" aria-modal="true" tabindex="-1" style="width:calc(100% - 20vw); height:calc(100% - 20vh); margin-left:10vw; margin-top:10vh; position:absolute; left:0; top:0; background:#fff; z-index:1; padding:40px; box-sizing:border-box;">
<h2 id="modal-heading">Hello</h2>
<p>Hello World!</p>
</div>
<iframe tabindex="-1" srcdoc="<a href='/'>Home</a>"></iframe>
```

[attribute value]: #attribute-value 'Definition of Attribute Value'
giacomo-petri marked this conversation as resolved.
Show resolved Hide resolved
[container document]: https://html.spec.whatwg.org/#bc-container-document 'HTML browsing context container document, 2020/12/18'
[document]: https://html.spec.whatwg.org/multipage/dom.html#document 'HTML definition of document'
[flattened tabindex-ordered focus navigation scope]: https://html.spec.whatwg.org/multipage/interaction.html#flattened-tabindex-ordered-focus-navigation-scope 'HTML - Living Standard, 2022/07/08'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
[flattened tabindex-ordered focus navigation scope]: https://html.spec.whatwg.org/multipage/interaction.html#flattened-tabindex-ordered-focus-navigation-scope 'HTML - Living Standard, 2022/07/08'
[flattened tabindex-ordered focus navigation scope]: https://html.spec.whatwg.org/multipage/interaction.html#flattened-tabindex-ordered-focus-navigation-scope 'HTML - Living Standard, 2022/07/08'
[inoperable]: https://www.w3.org/TR/wai-aria/#dfn-operable

Copy link
Member

Choose a reason for hiding this comment

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

This looks outdated?

[modal]: #modal-dialog 'Definition of Modal dialog'
[nested browsing context]: https://html.spec.whatwg.org/#nested-browsing-context 'HTML nested browsing context, 2020/12/18'
[owner document]: https://dom.spec.whatwg.org/#dom-node-ownerdocument 'DOM node owner document property, 2020/12/18'
[sc211]: https://www.w3.org/TR/WCAG21/#keyboard 'WCAG 2.1 Success criterion 2.1.1 Keyboard'
Expand Down
16 changes: 16 additions & 0 deletions pages/glossary/modal-dialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Modal dialog
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 concerned this could be confused by the <dialog>'s showModal() method.

key: modal-dialog
unambiguous: true
objective: true
input_aspects:
- Accessibility tree
- CSS styling
- DOM tree
---

A modal dialog is a type of user interface element that appears on top of the main content of a [html web page][] or application and requires the user to take some action or make a decision before they can continue interacting with the program.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think "type of user interface" is objective.
Same for "main content".
What is the "program" you mention?

I think this needs to focus on the element preventing interaction with all other elements that are not their children.

This definition really needs to be objective, because it is used in the applicability of the rule.

giacomo-petri marked this conversation as resolved.
Show resolved Hide resolved

Modal dialogs are typically used to display important messages, prompts, or alerts that require the user's attention and prevent them from interacting with other parts of the page until they have addressed the issue at hand. They are "modal" because they create a temporary mode where the user is focused on the dialog and cannot interact with the rest of the page.

[html web page]: #web-page-html 'Definition of Web Page'