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 all 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
1 change: 1 addition & 0 deletions __tests__/spelling-ignore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
- reflow
- Viewport
- dom-meta-content
- showModal

# Unsure why the dictionary does not have these words
- programmatically
Expand Down
36 changes: 35 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,7 +28,7 @@ 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][] 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][].
Expand Down Expand Up @@ -122,10 +122,44 @@ 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 tabindex="-1" inert srcdoc="<a href='/'>Home</a>"></iframe>
```

#### Inapplicable Example 6

Once the "Privacy policy details" button is activated, the `iframe` element becomes [inert][] because of the showModal() method, which causes the `iframe` to be [blocked by a modal].

```html
<iframe id="myFrame" title="Links" srcdoc="<a href='/'>Home</a>"></iframe>
<div>
<button id="ppButton" onclick="openDialog()">Privacy policy details</button>
</div>
<dialog id="ppDialog" aria-labelledby="dialogLabel">
<h2 id="dialogLabel">Privacy Policy</h2>
<p>We store no data.</p>
<button id="cancel" onclick="ppDialog.close()">Cancel</button>
</dialog>
<script>
const openDialog = () => {
ppDialog.showModal();
myFrame.tabIndex = '-1'
}
ppDialog.addEventListener('close', () => myFrame.tabIndex = 0)
window.addEventListener('DOMContentLoaded', openDialog);
</script>
```

[attribute value]: #attribute-value 'Definition of Attribute Value'
giacomo-petri marked this conversation as resolved.
Show resolved Hide resolved
[blocked by a modal]: https://html.spec.whatwg.org/multipage/interaction.html#blocked-by-a-modal-dialog
[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?

[inert]: #inert 'Definition of Inert'
[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
20 changes: 20 additions & 0 deletions pages/glossary/inert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Inert
key: inert
unambiguous: true
objective: true
input_aspects:
- Accessibility tree
- CSS styling
- DOM tree
---

An [HTML or SVG element][] is inert if:
- it has an `inert` [attribute value][] of true; or
- one of its ancestor elements in the [flat tree][] has an `inert` [attribute value][] of true; or
- it is [blocked by a modal][].

[HTML or SVG element]: #namespaced-element 'Definition of HTML or SVG element'
[attribute value]: #attribute-value 'Definition of Attribute value'
[blocked by a modal]: https://html.spec.whatwg.org/multipage/interaction.html#blocked-by-a-modal-dialog
giacomo-petri marked this conversation as resolved.
Show resolved Hide resolved
[flat tree]: https://drafts.csswg.org/css-scoping/#flat-tree 'Definition of flat tree'