Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
AX: elements with explicit tabindex should expose AXFocused as writab…
…le, since mouse clicks can focus it

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

Reviewed by Mario Sanchez Prada.

Source/WebCore:

Re-order logic that determines if a <span> should appear as an accessible element.
The change is that if an element canSetFocus() it should always be in the AX tree.

Test: accessibility/tabindex-elements-are-accessible.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):

LayoutTests:

* accessibility/tabindex-elements-are-accessible-expected.txt: Added.
* accessibility/tabindex-elements-are-accessible.html: Added.
      New test to ensure that if tabindex is on an element, it is in the AX tree.
* platform/mac/accessibility/table-with-row-col-of-headers-expected.txt:
* platform/mac/accessibility/table-with-row-col-of-headers.html:
      Update to reflect that if an ignored <table> has a tabindex, then it should at least be an AXGroup
* platform/mac/accessibility/update-children-when-aria-role-changes.html:
      Update so that the <span> elements being used don't have tabindex, which forces them to be in the AX tree,
      which changes the output of the test (basically we'd need to query the child of those elements instead).


Canonical link: https://commits.webkit.org/141568@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fleizach committed Oct 29, 2013
1 parent 97f3e09 commit 8aa3b51
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 17 deletions.
17 changes: 17 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
2013-10-29 Chris Fleizach <cfleizach@apple.com>

AX: elements with explicit tabindex should expose AXFocused as writable, since mouse clicks can focus it
https://bugs.webkit.org/show_bug.cgi?id=121335

Reviewed by Mario Sanchez Prada.

* accessibility/tabindex-elements-are-accessible-expected.txt: Added.
* accessibility/tabindex-elements-are-accessible.html: Added.
New test to ensure that if tabindex is on an element, it is in the AX tree.
* platform/mac/accessibility/table-with-row-col-of-headers-expected.txt:
* platform/mac/accessibility/table-with-row-col-of-headers.html:
Update to reflect that if an ignored <table> has a tabindex, then it should at least be an AXGroup
* platform/mac/accessibility/update-children-when-aria-role-changes.html:
Update so that the <span> elements being used don't have tabindex, which forces them to be in the AX tree,
which changes the output of the test (basically we'd need to query the child of those elements instead).

2013-10-28 Chris Fleizach <cfleizach@apple.com>

AX: Webkit does not expose AXRequired on input type=file
Expand Down
@@ -0,0 +1,28 @@
test test test
test

This tests that if tabindex is set on an object, it will be accessible (even if it is usually not)

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


Item 1: Is focusable: true
Item 1: AXRole: AXGroup


Item 2: Is focusable: true
Item 2: AXRole: AXGroup


Item 3: Is focusable: true
Item 3: AXRole: AXGroup


Item 4: Is focusable: true
Item 4: AXRole: AXGroup


PASS successfullyParsed is true

TEST COMPLETE

35 changes: 35 additions & 0 deletions LayoutTests/accessibility/tabindex-elements-are-accessible.html
@@ -0,0 +1,35 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>

<span tabindex="-1" id="item1">test</span>
<span tabindex="0" id="item2">test</span>
<span tabindex="1" id="item3">test</span>

<p tabindex="-1" id="item4">test


<p id="description"></p>
<div id="console"></div>

<script>

description("This tests that if tabindex is set on an object, it will be accessible (even if it is usually not)");

if (window.accessibilityController) {
for (var k = 1; k < 5; k++) {
var item = accessibilityController.accessibleElementById("item" + k);
debug("Item " + k + ": Is focusable: " + item.isFocusable);
debug("Item " + k + ": " + item.role);
debug("\n");
}
}

</script>

<script src="../resources/js-test-post.js"></script>
</body>
</html>
Expand Up @@ -13,8 +13,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE

PASS accessibilityController.focusedElement.role is 'AXRole: AXTable'
PASS accessibilityController.focusedElement.role is 'AXRole: AXTable'
PASS accessibilityController.focusedElement.role is 'AXRole: AXWebArea'
PASS accessibilityController.focusedElement.role is 'AXRole: AXWebArea'
PASS accessibilityController.focusedElement.role is 'AXRole: AXGroup'
PASS accessibilityController.focusedElement.role is 'AXRole: AXGroup'
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
Expand Up @@ -66,10 +66,10 @@
shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXTable'");

document.getElementById("table3").focus();
shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXWebArea'");
shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXGroup'");

document.getElementById("table4").focus();
shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXWebArea'");
shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXGroup'");
}

</script>
Expand Down
Expand Up @@ -10,8 +10,8 @@
<body>

<div id="parent" tabindex=0 role="group">
<span tabindex=0 role="button" id="button1">button 1</span>
<span tabindex=0 id="button2" title="button 2"></span>
<span role="button" id="button1">button 1</span>
<span id="button2" title="button 2"></span>
</div>

<p id="description"></p>
Expand Down
16 changes: 16 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
2013-10-29 Chris Fleizach <cfleizach@apple.com>

AX: elements with explicit tabindex should expose AXFocused as writable, since mouse clicks can focus it
https://bugs.webkit.org/show_bug.cgi?id=121335

Reviewed by Mario Sanchez Prada.

Re-order logic that determines if a <span> should appear as an accessible element.
The change is that if an element canSetFocus() it should always be in the AX tree.

Test: accessibility/tabindex-elements-are-accessible.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):

2013-10-29 Philippe Normand <pnormand@igalia.com>

[GTK] enable media-stream in build-webkit
Expand Down
22 changes: 11 additions & 11 deletions Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Expand Up @@ -1219,15 +1219,6 @@ bool AccessibilityRenderObject::computeAccessibilityIsIgnored() const
return false;
#endif

// <span> tags are inline tags and not meant to convey information if they have no other aria
// information on them. If we don't ignore them, they may emit signals expected to come from
// their parent. In addition, because included spans are GroupRole objects, and GroupRole
// objects are often containers with meaningful information, the inclusion of a span can have
// the side effect of causing the immediate parent accessible to be ignored. This is especially
// problematic for platforms which have distinct roles for textual block elements.
if (node && node->hasTagName(spanTag))
return true;

if (m_renderer->isRenderBlockFlow() && m_renderer->childrenInline() && !canSetFocusAttribute())
return !toRenderBlockFlow(m_renderer)->hasLines() && !mouseButtonListener();

Expand Down Expand Up @@ -1306,6 +1297,15 @@ bool AccessibilityRenderObject::computeAccessibilityIsIgnored() const
return false;
#endif

// <span> tags are inline tags and not meant to convey information if they have no other aria
// information on them. If we don't ignore them, they may emit signals expected to come from
// their parent. In addition, because included spans are GroupRole objects, and GroupRole
// objects are often containers with meaningful information, the inclusion of a span can have
// the side effect of causing the immediate parent accessible to be ignored. This is especially
// problematic for platforms which have distinct roles for textual block elements.
if (node && node->hasTagName(spanTag))
return true;

// Other non-ignored host language elements
if (node && node->hasTagName(dfnTag))
return false;
Expand Down Expand Up @@ -2542,8 +2542,8 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
if (m_renderer->isRenderBlockFlow())
return GroupRole;

// If the element does not have role, but it has ARIA attributes, accessibility should fallback to exposing it as a group.
if (supportsARIAAttributes())
// If the element does not have role, but it has ARIA attributes, or accepts tab focus, accessibility should fallback to exposing it as a group.
if (supportsARIAAttributes() || canSetFocusAttribute())
return GroupRole;

return UnknownRole;
Expand Down

0 comments on commit 8aa3b51

Please sign in to comment.