Skip to content
Permalink
Browse files
Expose the correct role, subrole and role description properties for …
…the <dialog> element.

https://bugs.webkit.org/show_bug.cgi?id=236359

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/dialog-properties.html

Elements with role="dialog" are exposed to accessibility clients with
role AXGroup, subrole AXApplicationDialog and role description
"web dialog". This patch implements this behavior for the <dialog>
element.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::defaultObjectInclusion const):

LayoutTests:

Tests that these AX properties have the expected values both when the
dialog is shown modal or modeless.

* accessibility/dialog-properties-expected.txt: Added.
* accessibility/dialog-properties.html: Added.



Canonical link: https://commits.webkit.org/247198@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289713 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
AndresGonzalezApple committed Feb 13, 2022
1 parent 85de703 commit f5e42d63fc9dc2dd7b369877125d977c3d2059cd
Showing 8 changed files with 110 additions and 4 deletions.
@@ -1,3 +1,16 @@
2022-02-13 Andres Gonzalez <andresg_22@apple.com>

Expose the correct role, subrole and role description properties for the <dialog> element.
https://bugs.webkit.org/show_bug.cgi?id=236359

Reviewed by Chris Fleizach.

Tests that these AX properties have the expected values both when the
dialog is shown modal or modeless.

* accessibility/dialog-properties-expected.txt: Added.
* accessibility/dialog-properties.html: Added.

2022-02-12 Tim Nguyen <ntim@apple.com>

Skip imported/w3c/web-platform-tests/url/toascii.window.html on Catalina/Big Sur
@@ -0,0 +1,15 @@
This test verifies several AX properties of the dialog element.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


Modal dialog:
AXRole: AXGroup AXSubrole: AXApplicationDialog AXRoleDescription: web dialog
Modeless dialog:
AXRole: AXGroup AXSubrole: AXApplicationDialog AXRoleDescription: web dialog
PASS successfullyParsed is true

TEST COMPLETE
Just a dialog.

OK Cancel
@@ -0,0 +1,50 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body id="body">

<dialog id="dialog">
<h3>Just a dialog.</h3>
<button id="ok" onclick="document.getElementById('dialog').close();" class="close-button">OK</button>
<button onclick="document.getElementById('dialog').close();" class="close-button">Cancel</button>
</dialog>

<script>
description("This test verifies several AX properties of the dialog element.");

if (window.accessibilityController) {
window.jsTestIsAsync = true;

setTimeout(async () => {
// Show the dialog as modal.
debug("Modal dialog:");
document.getElementById("dialog").showModal();
let dialog = null;
await waitFor(() => {
dialog = accessibilityController.accessibleElementById("dialog");
return dialog;
});
let properties = `${dialog.role} ${dialog.subrole} ${dialog.roleDescription}`;
debug(properties);

// Dismiss the modal and show the dialog as modeless.
document.getElementById("dialog").close();
debug("Modeless dialog:");
document.getElementById("dialog").show();
dialog = null;
await waitFor(() => {
dialog = accessibilityController.accessibleElementById("dialog");
return dialog;
});
properties = `${dialog.role} ${dialog.subrole} ${dialog.roleDescription}`;
debug(properties);

finishJSTest();
}, 0);
}
</script>
</body>
</html>
@@ -1849,6 +1849,8 @@ webkit.org/b/160119 fast/repaint/selection-gap-flipped-fixed-child.html [ Failur
# UNSORTED Expectations. When in doubt, put it here.
#////////////////////////////////////////////////////////////////////////////////////////

accessibility/dialog-properties.html [ Skip ]

# These tests require platform support.
media/media-allowed-codecs.html
media/media-allowed-containers.html
@@ -4920,6 +4920,7 @@ webkit.org/b/229300 http/tests/security/no-javascript-refresh-spaces.py [ Pass C

accessibility/selected-state-changed-notifications.html [ Skip ]
accessibility/element-line-rects-and-text.html [ Skip ]
accessibility/dialog-properties.html [ Skip ]

webkit.org/b/229247 http/tests/fetch/keepalive-fetch-2.html [ Pass Failure ]

@@ -1,3 +1,22 @@
2022-02-13 Andres Gonzalez <andresg_22@apple.com>

Expose the correct role, subrole and role description properties for the <dialog> element.
https://bugs.webkit.org/show_bug.cgi?id=236359

Reviewed by Chris Fleizach.

Test: accessibility/dialog-properties.html

Elements with role="dialog" are exposed to accessibility clients with
role AXGroup, subrole AXApplicationDialog and role description
"web dialog". This patch implements this behavior for the <dialog>
element.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::determineAccessibilityRoleFromNode const):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::defaultObjectInclusion const):

2022-02-13 Alan Bujtas <zalan@apple.com>

[LFC][Integration] Introduce Box::ElementType::IntegrationInlineBlock
@@ -358,6 +358,8 @@ AccessibilityRole AccessibilityNodeObject::determineAccessibilityRoleFromNode(Tr
return AccessibilityRole::Blockquote;
if (node()->hasTagName(captionTag))
return AccessibilityRole::Caption;
if (node()->hasTagName(dialogTag))
return AccessibilityRole::ApplicationDialog;
if (node()->hasTagName(markTag))
return AccessibilityRole::Mark;
if (node()->hasTagName(preTag))
@@ -414,7 +416,7 @@ AccessibilityRole AccessibilityNodeObject::determineAccessibilityRoleFromNode(Tr
return AccessibilityRole::Group;
if (is<Element>(*node()) && downcast<Element>(*node()).isFocusable())
return AccessibilityRole::Group;

return AccessibilityRole::Unknown;
}

@@ -3612,16 +3612,20 @@ String AccessibilityObject::validationMessage() const
AccessibilityObjectInclusion AccessibilityObject::defaultObjectInclusion() const
{
bool useParentData = !m_isIgnoredFromParentData.isNull();

if (useParentData ? m_isIgnoredFromParentData.isAXHidden : isAXHidden())
return AccessibilityObjectInclusion::IgnoreObject;

if ((renderer() && renderer()->style().effectiveInert()) || ignoredFromModalPresence())
return AccessibilityObjectInclusion::IgnoreObject;

if (useParentData ? m_isIgnoredFromParentData.isPresentationalChildOfAriaRole : isPresentationalChildOfAriaRole())
return AccessibilityObjectInclusion::IgnoreObject;


// Include <dialog> elements and elements with role="dialog".
if (roleValue() == AccessibilityRole::ApplicationDialog)
return AccessibilityObjectInclusion::IncludeObject;

return accessibilityPlatformIncludesObject();
}

0 comments on commit f5e42d6

Please sign in to comment.