AX: Children inside a <legend> are not accessible
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Sep 2014 16:13:23 +0000 (16:13 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Sep 2014 16:13:23 +0000 (16:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136735

Reviewed by Mario Sanchez Prada.

Source/WebCore:

The AX children of a <legend> are being hidden currently, which makes it impossible for
VoiceOver to activate control elements inside of a <legend>.
The solution is that legend elements SHOULD be allowed to have children.

Test: accessibility/legend-children-are-visible.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren):

LayoutTests:

* accessibility/legend-children-are-visible-expected.txt: Added.
* accessibility/legend-children-are-visible.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173515 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/legend-children-are-visible-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/legend-children-are-visible.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityNodeObject.cpp

index a561cf4..93e23db 100644 (file)
@@ -1,3 +1,13 @@
+2014-09-11  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Children inside a <legend> are not accessible
+        https://bugs.webkit.org/show_bug.cgi?id=136735
+
+        Reviewed by Mario Sanchez Prada.
+
+        * accessibility/legend-children-are-visible-expected.txt: Added.
+        * accessibility/legend-children-are-visible.html: Added.
+
 2014-09-11  Philippe Normand  <pnormand@igalia.com>
 
         [GTK] Layout Test http/tests/media/hls/video-controls-live-stream.html is flaky
diff --git a/LayoutTests/accessibility/legend-children-are-visible-expected.txt b/LayoutTests/accessibility/legend-children-are-visible-expected.txt
new file mode 100644 (file)
index 0000000..689ac78
--- /dev/null
@@ -0,0 +1,12 @@
+This tests that children of a will be visible to the AX hierarchy (so that in case a control element is inside, it can be reached)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+fieldset description: AXDescription: Not link Link
+legend child 1: string value: AXValue: Not link 
+legend child 2: title: AXTitle: Link
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/legend-children-are-visible.html b/LayoutTests/accessibility/legend-children-are-visible.html
new file mode 100644 (file)
index 0000000..2cae7b6
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div id="content">
+
+<form>
+    <fieldset id="fieldset">
+        <legend>Not link <a href="http://www.apple.com">Link</a></legend>
+        <label for="green">Green</label>
+        <input type="radio" name="color" id="green">
+    </fieldset>
+</form>
+
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that children of a <legend> will be visible to the AX hierarchy (so that in case a control element is inside, it can be reached)");
+
+    if (window.accessibilityController) {
+          var fieldset = accessibilityController.accessibleElementById("fieldset");
+          var legendChild1 = fieldset.childAtIndex(0);
+          var legendChild2 = fieldset.childAtIndex(1);
+          debug("fieldset description: " + fieldset.description);
+          debug("legend child 1: string value: " + legendChild1.stringValue);
+          debug("legend child 2: title: " + legendChild2.title);
+
+          document.getElementById("content").style.visibility = "hidden";
+    }
+
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index 94dfded..1652974 100644 (file)
@@ -1,3 +1,19 @@
+2014-09-11  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Children inside a <legend> are not accessible
+        https://bugs.webkit.org/show_bug.cgi?id=136735
+
+        Reviewed by Mario Sanchez Prada.
+
+        The AX children of a <legend> are being hidden currently, which makes it impossible for
+        VoiceOver to activate control elements inside of a <legend>.
+        The solution is that legend elements SHOULD be allowed to have children.
+
+        Test: accessibility/legend-children-are-visible.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::canHaveChildren):
+
 2014-09-11  Brendan Long  <b.long@cablelabs.com>
 
         Fix FIXME's in JSTrackCustom now that AudioTrack and VideoTrack exist.
index 80432da..2db56eb 100644 (file)
@@ -400,10 +400,6 @@ bool AccessibilityNodeObject::canHaveChildren() const
     case ScrollBarRole:
     case ProgressIndicatorRole:
         return false;
-    case LegendRole:
-        if (Element* element = this->element())
-            return !ancestorsOfType<HTMLFieldSetElement>(*element).first();
-        FALLTHROUGH;
     default:
         return true;
     }