Changeset 285791 in webkit
- Timestamp:
- Nov 14, 2021 10:47:32 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-unfocusable-expected.txt (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-unfocusable.html (modified) (3 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Node.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r285745 r285791 1 2021-11-14 Tim Nguyen <ntim@apple.com> 2 3 Modal dialogs should make the root element unfocusable 4 https://bugs.webkit.org/show_bug.cgi?id=233099 5 6 Reviewed by Simon Fraser. 7 8 From https://html.spec.whatwg.org/multipage/interaction.html#inert, 9 10 > A Document document is blocked by a modal dialog subject if subject is 11 > the topmost dialog element in document's top layer. While document is 12 > so blocked, every node that is connected to document, with the 13 > exception of the subject element and its shadow-including descendants, 14 > must be marked inert. 15 16 RenderStyle::effectiveInert() already matches this definition, Node::deprecatedIsInert() does not. 17 18 Main reason the removed check was there is to prevent the whole document from being inert to hit-testing, but with the RenderStyle 19 approach, we instead override effectiveInert to false for the modal dialog. Removing this check for focus is absolutely fine 20 however, since focusability isn't inherited (Node::deprecatedIsInert is only used for focus). 21 22 Tests added by this Chromium WPT: https://github.com/web-platform-tests/wpt/commit/0457111e7109ec3d9e575aa421b96d8c36ce2ae8 23 24 * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-unfocusable-expected.txt: 25 * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-unfocusable.html: 26 1 27 2021-11-12 Ryan Haddad <ryanhaddad@apple.com> 2 28 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-unfocusable-expected.txt
r281309 r285791 1 I get focusI don't get focus.2 1 3 2 I'm editable … … 5 4 Link 6 5 7 PASS Test that inert nodes are not focusable. 6 PASS #html is not focusable 7 PASS #body is not focusable 8 PASS #top-dialog is focusable 9 PASS #top-dialog-button is focusable 10 PASS #bottom-dialog is not focusable 11 PASS #bottom-dialog-button is not focusable 12 PASS #container is not focusable 13 PASS #text is not focusable 14 PASS #datetime is not focusable 15 PASS #color is not focusable 16 PASS #select is not focusable 17 PASS #optgroup is not focusable 18 PASS #option is not focusable 19 PASS #contenteditable-div is not focusable 20 PASS #tabindex-span is not focusable 8 21 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-unfocusable.html
r249886 r285791 1 1 <!DOCTYPE html> 2 <html >2 <html id="html" tabindex="1"> 3 3 <head> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#blocked-by-a-modal-dialog"> 5 <meta name="assert" content="Checks that, when opening modal dialogs, inert nodes are not focusable."> 4 6 <script src="/resources/testharness.js"></script> 5 7 <script src="/resources/testharnessreport.js"></script> … … 27 29 28 30 function testFocus(element, expectFocus) { 29 var focusedElement = null; 30 element.addEventListener('focus', function() { focusedElement = element; }, false); 31 element.focus(); 32 var theElement = element; 33 assert_equals(focusedElement === theElement, expectFocus, element.id); 31 test(function() { 32 var focusedElement = null; 33 element.addEventListener('focus', function() { focusedElement = element; }, false); 34 element.focus(); 35 var theElement = element; 36 if (expectFocus) { 37 assert_equals(focusedElement, theElement); 38 } else { 39 assert_not_equals(focusedElement, theElement); 40 } 41 }, `#${CSS.escape(element.id)} is ${expectFocus ? "" : "not "} focusable`); 34 42 } 35 43 … … 42 50 } 43 51 44 test(function() { 45 var bottomDialog = document.getElementById('bottom-dialog'); 52 var bottomDialog = document.getElementById('bottom-dialog'); 53 var topDialog = document.getElementById('top-dialog'); 54 setup(function() { 46 55 bottomDialog.showModal(); 56 topDialog.showModal(); 57 add_completion_callback(function() { 58 topDialog.close(); 59 bottomDialog.close(); 60 }); 61 }); 47 62 48 var topDialog = document.getElementById('top-dialog'); 49 topDialog.showModal(); 50 51 testFocus(document.body, false); 52 testTree(topDialog, true); 53 testTree(bottomDialog, false); 54 testTree(document.getElementById('container'), false); 55 }, "Test that inert nodes are not focusable."); 63 testFocus(document.documentElement, false); 64 testFocus(document.body, false); 65 testTree(topDialog, true); 66 testTree(bottomDialog, false); 67 testTree(document.getElementById('container'), false); 56 68 </script> 57 69 </body> -
trunk/Source/WebCore/ChangeLog
r285790 r285791 1 2021-11-14 Tim Nguyen <ntim@apple.com> 2 3 Modal dialogs should make the root element unfocusable 4 https://bugs.webkit.org/show_bug.cgi?id=233099 5 6 Reviewed by Simon Fraser. 7 8 From https://html.spec.whatwg.org/multipage/interaction.html#inert, 9 10 > A Document document is blocked by a modal dialog subject if subject is 11 > the topmost dialog element in document's top layer. While document is 12 > so blocked, every node that is connected to document, with the 13 > exception of the subject element and its shadow-including descendants, 14 > must be marked inert. 15 16 RenderStyle::effectiveInert() already matches this definition, Node::deprecatedIsInert() does not. 17 18 Main reason the removed check was there is to prevent the whole document from being inert to hit-testing, but with the RenderStyle 19 approach, we instead override effectiveInert to false for the modal dialog. Removing this check for focus is absolutely fine 20 however, since focusability isn't inherited (Node::deprecatedIsInert is only used for focus). 21 22 Tests added by this Chromium WPT: https://github.com/web-platform-tests/wpt/commit/0457111e7109ec3d9e575aa421b96d8c36ce2ae8 23 24 * dom/Node.cpp: 25 (WebCore::Node::deprecatedIsInert const): 26 1 27 2021-11-14 Simon Fraser <simon.fraser@apple.com> 2 28 -
trunk/Source/WebCore/dom/Node.cpp
r284366 r285791 2629 2629 return true; 2630 2630 2631 if (this != &document() && this != document().documentElement()) {2631 if (this != &document()) { 2632 2632 Node* activeModalDialog = document().activeModalDialog(); 2633 2633 if (activeModalDialog && !activeModalDialog->containsIncludingShadowDOM(this))
Note: See TracChangeset
for help on using the changeset viewer.