From 2f08a87ec42c9d5b8ab01f1e2bb43d7ea2becd5a Mon Sep 17 00:00:00 2001 From: sefeng Date: Fri, 8 May 2020 12:25:42 -0400 Subject: [PATCH] Fix a dialog focus test that expects a wrong element to be focused Per spec, when there are no descendant elements that match the requirement, the dialog element itself should be focused. --- .../the-dialog-element/show-modal-focusing-steps.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.html b/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.html index 164b41459d1760..8473d1d5f84c3d 100644 --- a/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.html +++ b/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.html @@ -10,10 +10,11 @@ outerButton = document.getElementById('outer-button'); assert_equals(document.activeElement, outerButton); - // Test that focus goes to body if the dialog has no focusable elements, including itself + // dialog element itself should be focused when no descendant + // element matches the requirements. var outerDialog = document.getElementById('outer-dialog'); outerDialog.showModal(); - assert_equals(document.activeElement, document.body); + assert_equals(document.activeElement, outerDialog); // Test that an autofocus element in the dialog gets focus. var dialog = document.getElementById('dialog');