-
Notifications
You must be signed in to change notification settings - Fork 70
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
Conversation
|
||
- 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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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".
|
||
- 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: | ||
- it has an `inert` [attribute value][] of true; or | ||
- 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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…)
pages/glossary/modal-dialog.md
Outdated
- 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. |
There was a problem hiding this comment.
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.
|
||
- 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: | ||
- it has an `inert` [attribute value][] of true; or | ||
- 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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?
There was a problem hiding this comment.
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 theis-modal
flag set totrue
, and is not a descendant of thatdialog
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.
There was a problem hiding this comment.
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.
</div> | ||
<iframe tabindex="-1" srcdoc="<a href='/'>Home</a>"></iframe> | ||
``` | ||
|
||
[attribute value]: #attribute-value 'Definition of Attribute Value' | ||
[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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks outdated?
|
||
- 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: | ||
- it has an `inert` [attribute value][] of true; or |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
||
- 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: | ||
- it has an `inert` [attribute value][] of true; or | ||
- 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. |
There was a problem hiding this comment.
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 theis-modal
flag set totrue
, and is not a descendant of thatdialog
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.
pages/glossary/modal-dialog.md
Outdated
@@ -0,0 +1,16 @@ | |||
--- | |||
title: Modal dialog |
There was a problem hiding this comment.
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.
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
|
||
- 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: | ||
- it has an `inert` [attribute value][] of true; or | ||
- 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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. |
Co-authored-by: Dan Tripp <[email protected]>
Changes were done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To sum up, I think we can just use HTML definition of inert (instead of trying to rebuild it) + add some background description about showModal
triggering "blocked by a modal" triggering inert + make the examples descriptions clear (this iframe
is inert because it is blocked by the modal that has been brought to the top layer with showModal
).
|
||
- 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: |
There was a problem hiding this comment.
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".
|
||
- 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: | ||
- it has an `inert` [attribute value][] of true; or | ||
- 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. |
There was a problem hiding this comment.
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…)
|
||
- 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: | ||
- it has an `inert` [attribute value][] of true; or | ||
- 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. |
There was a problem hiding this comment.
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.
As a rule of thumb, I feel it is good to include the full name of the updated rule in the PR title. Including the rule ID can also help tracking them across change of name (the id is the stable name). I usually like to frontload these, but we have no strict PR naming convention.
(I feel that "update rule" is a bit redundant in a PR title, since PR are mostly made to update rules) |
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Jean-Yves Moyen <[email protected]> Co-authored-by: Dan Tripp <[email protected]>
|
suggestions applied and highlighted items resolved
we moved with the definition of blocked by a modal, that should solve the item highlighted
Call for review ends June 21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
From the list email, I had expected I would have concern about defining inert
. Instead, I was delighted to learn that it is a reasonably well defined attribute.
I don't think my own knowledge is too below average, so I recommend adding links for background reading. Here are two I found useful:
@bruce-usab Since ACT rules are intended to be published as official W3C documentation, we tend to avoid direct links (or citation) of commercial third parties, especially when they are themselves major players (we do not want to look like we favour one above the others). As much as we can, we'd rather stick with W3C documentation (HTML living standard, …) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple minor points. Don't expect any discussion necessary on these.
_rules/iframe-not-focusable-has-no-interactive-content-akn7bn.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Wilco Fiers <[email protected]>
This PR is in call for review for 2 weeks. Review ends Sept 29th. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff!
This pull request manages inert iframe elements in iframe with interactive elements is not excluded from tab-order rule, excluding them from the applicability of the rule.
Updates:
Closes issue(s): #1965
Need for Call for Review:
This will require a 2 weeks Call for Review
Pull Request Etiquette
When creating PR:
develop
branch (left side).After creating PR:
Rule
,Definition
orChore
.When merging a PR:
How to Review And Approve