Skip to content

Commit

Permalink
Merge r175241 - AX: input type=hidden is being exposed when aria-hidd…
Browse files Browse the repository at this point in the history
…en=false

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

Reviewed by Benjamin Poulain.

Source/WebCore:

If an input type=hidden was inside an aria-hidden=false, it would appear because
the lack of a RenderObject behind that object was not blocking its adoption into the AX tree.
We should explicity check for whether the type is hidden and then return an appropriate role.

Test: accessibility/input-type-hidden-in-aria-hidden-false.html

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

LayoutTests:

* accessibility/input-type-hidden-in-aria-hidden-false-expected.txt: Added.
* accessibility/input-type-hidden-in-aria-hidden-false.html: Added.

Canonical link: https://commits.webkit.org/154760.164@webkitgtk/2.6
git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@175917 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fleizach authored and carlosgcampos committed Nov 11, 2014
1 parent 65c7058 commit 8e5c42b
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 1 deletion.
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
2014-10-27 Chris Fleizach <cfleizach@apple.com>

AX: input type=hidden is being exposed when aria-hidden=false
https://bugs.webkit.org/show_bug.cgi?id=138106

Reviewed by Benjamin Poulain.

* accessibility/input-type-hidden-in-aria-hidden-false-expected.txt: Added.
* accessibility/input-type-hidden-in-aria-hidden-false.html: Added.

2014-10-29 Chris Dumez <cdumez@apple.com>

Crash in CachedRawResource::canReuse() when reloading http://dnd.wizards.com/dungeons-and-dragons/story
Expand Down
@@ -0,0 +1,13 @@
This tests that input type of hidden are not exposed when aria-hidden=false

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


PASS content.childrenCount is 0
PASS !content || !content.isValid() is true
PASS content.childrenCount is 0
PASS !content || !content.isValid() is true
PASS successfullyParsed is true

TEST COMPLETE

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

<div id="content" role="group">
<input type="hidden">
</div>

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

<script>

description("This tests that input type of hidden are not exposed when aria-hidden=false");

if (window.accessibilityController) {
// By default, this should have no children because input type=hidden is hidden.
var content = accessibilityController.accessibleElementById("content");
shouldBe("content.childrenCount", "0");

// When aria-hidden=true, content should not even be there
document.getElementById("content").setAttribute("aria-hidden", "true");
content = accessibilityController.accessibleElementById("content");
shouldBeTrue("!content || !content.isValid()");

// When aria-hidden=false, we should NOT expose input type=hidden
document.getElementById("content").setAttribute("aria-hidden", "false");
content = accessibilityController.accessibleElementById("content");
shouldBe("content.childrenCount", "0");

// And changing back to true on the fly should have a similar effect
document.getElementById("content").setAttribute("aria-hidden", "true");
content = accessibilityController.accessibleElementById("content");
shouldBeTrue("!content || !content.isValid()");
}

</script>

<script src="../resources/js-test-post.js"></script>
</body>
</html>
17 changes: 17 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,20 @@
2014-10-27 Chris Fleizach <cfleizach@apple.com>

AX: input type=hidden is being exposed when aria-hidden=false
https://bugs.webkit.org/show_bug.cgi?id=138106

Reviewed by Benjamin Poulain.

If an input type=hidden was inside an aria-hidden=false, it would appear because
the lack of a RenderObject behind that object was not blocking its adoption into the AX tree.
We should explicity check for whether the type is hidden and then return an appropriate role.

Test: accessibility/input-type-hidden-in-aria-hidden-false.html

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

2014-10-29 Chris Dumez <cdumez@apple.com>

Crash in CachedRawResource::canReuse() when reloading http://dnd.wizards.com/dungeons-and-dragons/story
Expand Down
7 changes: 6 additions & 1 deletion Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Expand Up @@ -297,7 +297,9 @@ AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
return buttonRoleType();
if (input->isRangeControl())
return SliderRole;

if (input->isInputTypeHidden())
return IgnoredRole;

#if ENABLE(INPUT_TYPE_COLOR)
const AtomicString& type = input->getAttribute(typeAttr);
if (equalIgnoringCase(type, "color"))
Expand Down Expand Up @@ -431,6 +433,9 @@ bool AccessibilityNodeObject::computeAccessibilityIsIgnored() const
if (isDescendantOfBarrenParent())
return true;

if (roleValue() == IgnoredRole)
return true;

return m_role == UnknownRole;
}

Expand Down

0 comments on commit 8e5c42b

Please sign in to comment.