- Revision
- 148652
- Author
- [email protected]
- Date
- 2013-04-17 17:37:14 -0700 (Wed, 17 Apr 2013)
Log Message
AX: VoiceOver says everything that isn't a link is a "clickable" in Safari reader?
https://bugs.webkit.org/show_bug.cgi?id=114687
Reviewed by Tim Horton.
Source/WebCore:
VoiceOver is saying all text is clickable, because AXPress is exposed as an action on static text.
That is happening, because there's a click handler on the body element in this case.
I think the best plan to keep existing functionality, but fix this case is not to expose
the press action for static text when the handler is on the body element.
Test: platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::mouseButtonListener):
Change from checking getAttributeEventListener to hasEventListeners. The former only
checks if "onclick" is installed on the element and does not work with addEventListener!
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isStaticText):
LayoutTests:
* platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler-expected.txt: Added.
* platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (148651 => 148652)
--- trunk/LayoutTests/ChangeLog 2013-04-18 00:04:49 UTC (rev 148651)
+++ trunk/LayoutTests/ChangeLog 2013-04-18 00:37:14 UTC (rev 148652)
@@ -1,3 +1,13 @@
+2013-04-17 Chris Fleizach <[email protected]>
+
+ AX: VoiceOver says everything that isn't a link is a "clickable" in Safari reader?
+ https://bugs.webkit.org/show_bug.cgi?id=114687
+
+ Reviewed by Tim Horton.
+
+ * platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler-expected.txt: Added.
+ * platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler.html: Added.
+
2013-04-17 Jessie Berlin <[email protected]>
Remove the mac-snowleopard LayoutTest directory.
Added: trunk/LayoutTests/platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler-expected.txt (0 => 148652)
--- trunk/LayoutTests/platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler-expected.txt 2013-04-18 00:37:14 UTC (rev 148652)
@@ -0,0 +1,21 @@
+
+This tests that if the body or html tags have click handlers, then non-control elements do not automatically have the press action on them.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS text1.role is 'AXRole: AXStaticText'
+PASS text2.role is 'AXRole: AXStaticText'
+When a click handler is on the HTML tag, AXPress should not be supported on static text children elements automatically.
+PASS text1.isPressActionSupported() is false
+PASS text2.isPressActionSupported() is false
+When a click handler is on the BODY tag, AXPress should not be supported on static text children elements automatically.
+PASS text1.isPressActionSupported() is false
+PASS text2.isPressActionSupported() is false
+When a click handler is on a parent tag, AXPress should be supported on static text children elements automatically.
+PASS text1.isPressActionSupported() is true
+PASS text2.isPressActionSupported() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler.html (0 => 148652)
--- trunk/LayoutTests/platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler.html 2013-04-18 00:37:14 UTC (rev 148652)
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html id="html">
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="group1" role="group">
+text1
+<br>
+<div role="text" id="text2">text2</div>
+
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that if the body or html tags have click handlers, then non-control elements do not automatically have the press action on them.");
+
+ if (window.accessibilityController) {
+
+ function listener() { }
+
+ var group = accessibilityController.accessibleElementById("group1");
+ var text1 = group.childAtIndex(0).childAtIndex(0);
+ var text2 = accessibilityController.accessibleElementById("text2");
+
+ shouldBe("text1.role", "'AXRole: AXStaticText'");
+ shouldBe("text2.role", "'AXRole: AXStaticText'");
+
+ document.getElementById("html").addEventListener('click', listener, false);
+
+ debug("When a click handler is on the HTML tag, AXPress should not be supported on static text children elements automatically.");
+ shouldBeFalse("text1.isPressActionSupported()");
+ shouldBeFalse("text2.isPressActionSupported()");
+
+ document.getElementById("html").removeEventListener('click', listener, false);
+ document.getElementById("body").addEventListener('click', listener, false);
+
+ debug("When a click handler is on the BODY tag, AXPress should not be supported on static text children elements automatically.");
+ shouldBeFalse("text1.isPressActionSupported()");
+ shouldBeFalse("text2.isPressActionSupported()");
+
+ document.getElementById("body").removeEventListener('click', listener, false);
+ document.getElementById("group1").addEventListener('click', listener, false);
+
+ debug("When a click handler is on a parent tag, AXPress should be supported on static text children elements automatically.");
+ shouldBeTrue("text1.isPressActionSupported()");
+ shouldBeTrue("text2.isPressActionSupported()");
+
+ document.getElementById("group1").style.visibility = "hidden";
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (148651 => 148652)
--- trunk/Source/WebCore/ChangeLog 2013-04-18 00:04:49 UTC (rev 148651)
+++ trunk/Source/WebCore/ChangeLog 2013-04-18 00:37:14 UTC (rev 148652)
@@ -1,3 +1,28 @@
+2013-04-17 Chris Fleizach <[email protected]>
+
+ AX: VoiceOver says everything that isn't a link is a "clickable" in Safari reader?
+ https://bugs.webkit.org/show_bug.cgi?id=114687
+
+ Reviewed by Tim Horton.
+
+ VoiceOver is saying all text is clickable, because AXPress is exposed as an action on static text.
+ That is happening, because there's a click handler on the body element in this case.
+
+ I think the best plan to keep existing functionality, but fix this case is not to expose
+ the press action for static text when the handler is on the body element.
+
+ Test: platform/mac/accessibility/press-action-not-exposed-when-body-is-click-handler.html
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::AccessibilityNodeObject::mouseButtonListener):
+ Change from checking getAttributeEventListener to hasEventListeners. The former only
+ checks if "onclick" is installed on the element and does not work with addEventListener!
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilityObject::isStaticText):
+
2013-04-17 Simon Fraser <[email protected]>
Fix GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() to do predictive visible rect expansion
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (148651 => 148652)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2013-04-18 00:04:49 UTC (rev 148651)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2013-04-18 00:37:14 UTC (rev 148652)
@@ -949,7 +949,12 @@
// FIXME: Do the continuation search like anchorElement does
for (Element* element = toElement(node); element; element = element->parentElement()) {
- if (element->getAttributeEventListener(eventNames().clickEvent) || element->getAttributeEventListener(eventNames().mousedownEvent) || element->getAttributeEventListener(eventNames().mouseupEvent))
+ // If we've reached the body and this is not a control element, do not expose press action for this element.
+ // It can cause false positives, where every piece of text is labeled as accepting press actions.
+ if (element->hasTagName(bodyTag) && isStaticText())
+ break;
+
+ if (element->hasEventListeners(eventNames().clickEvent) || element->hasEventListeners(eventNames().mousedownEvent) || element->hasEventListeners(eventNames().mouseupEvent))
return element;
}
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (148651 => 148652)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2013-04-18 00:04:49 UTC (rev 148651)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2013-04-18 00:37:14 UTC (rev 148652)
@@ -210,7 +210,7 @@
&& axObject->roleValue() == criteria->startObject->roleValue();
case StaticTextSearchKey:
- return axObject->hasStaticText();
+ return axObject->isStaticText();
case StyleChangeSearchKey:
return criteria->startObject
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (148651 => 148652)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2013-04-18 00:04:49 UTC (rev 148651)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2013-04-18 00:37:14 UTC (rev 148652)
@@ -480,7 +480,7 @@
virtual bool hasSameFont(RenderObject*) const { return false; }
virtual bool hasSameFontColor(RenderObject*) const { return false; }
virtual bool hasSameStyle(RenderObject*) const { return false; }
- bool hasStaticText() const { return roleValue() == StaticTextRole; }
+ bool isStaticText() const { return roleValue() == StaticTextRole; }
virtual bool hasUnderline() const { return false; }
bool hasHighlighting() const;