From 0d483a3bea340a2c60cb7a4add49eb63cbba2a64 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Fri, 11 Feb 2022 18:13:53 +0100 Subject: [PATCH] Stop propagating inertness into nested browsing contexts See https://github.com/whatwg/html/issues/7605 --- .../inert-focus-in-frames.html | 8 +++++-- ...rtness-with-modal-dialogs-and-iframes.html | 21 +++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html b/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html index 12fa96abc2d03b..2ccc13328572c1 100644 --- a/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html +++ b/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html @@ -37,7 +37,11 @@ let focusedElement = null; element.addEventListener('focus', function() { focusedElement = element; }, false); element.focus(); - assert_equals(focusedElement === element, expectFocus, element.id); + if (expectFocus) { + assert_equals(focusedElement, element, element.id); + } else { + assert_not_equals(focusedElement, element, element.id); + } } // Opening a modal dialog in frame1. It blocks other nodes in its document. @@ -46,7 +50,7 @@ testFocus(frame1.querySelector('.target'), false); const iframe = frame1.querySelector('#iframe1').contentDocument; - testFocus(iframe.querySelector('.target'), false); + testFocus(iframe.querySelector('.target'), true); // Even a modal dialog in the iframe is blocked by the modal dialog in the parent frame1. iframe.querySelector('dialog').showModal(); diff --git a/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html b/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html index ea7d46f98db86c..1a509f7f36579f 100644 --- a/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html +++ b/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html @@ -4,9 +4,8 @@ + but only in its document, not in the parent browsing context, + nor in nested browsing contexts.">
(main document: outer text) @@ -103,30 +102,30 @@ checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: outer text)(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialog in the main document marks outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: outer text)(outer iframe: dialog)"); +}, "Modal dialog in the main document marks outer nodes as inert. Contents of the outer iframe aren't marked as inert."); promise_test(async function() { showModals(this, [innerIframeWindow, window]); checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialogs in the main document and inner iframe mark outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: outer text)(outer iframe: dialog)"); +}, "Modal dialogs in the main document and inner iframe mark outer nodes as inert. Contents of the outer iframe aren't marked as inert."); promise_test(async function() { showModals(this, [outerIframeWindow, window]); checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: outer text)(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialogs in the main document and outer iframe mark outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: dialog)"); +}, "Modal dialogs in the main document and outer iframe mark outer nodes as inert. Contents of the outer iframe aren't marked as inert."); promise_test(async function() { showModals(this, [innerIframeWindow, outerIframeWindow, window]); checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialogs in the main document and both iframes mark outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: dialog)"); +}, "Modal dialogs in the main document and both iframes mark outer nodes as inert. Contents of the outer iframe aren't marked as inert.");