Bug 494345 - Do not create accessibles for XUL label or description having a role of 'presentation', r=marcoz, enndeaking, sr=smaug

This commit is contained in:
Alexander Surkov 2009-07-10 20:17:15 +08:00
Родитель 4587e9d812
Коммит 2f51edc3a4
4 изменённых файлов: 69 добавлений и 1 удалений

Просмотреть файл

@ -76,6 +76,7 @@ _TEST_FILES =\
test_aria_role_equation.html \
test_aria_role_grid.html \
test_aria_roles.html \
test_aria_roles.xul \
test_aria_token_attrs.html \
test_bug420863.html \
$(warning test_childAtPoint.html temporarily disabled) \

Просмотреть файл

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessibility Name Calculating Test.">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript">
<![CDATA[
function doTest()
{
ok(!isAccessible("presentation_label"),
"Presentation label shouldn't be accessible.");
ok(!isAccessible("presentation_descr"),
"Presentation description shouldn't be accessible.");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=494345"
title="Do not create accessibles for XUL label or description having a role of 'presentation'">
Mozilla Bug 494345
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<label id="presentation_label" role="presentation" value="label"/>
<description id="presentation_descr" role="presentation" value="description"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -1267,6 +1267,12 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
tag == nsGkAtoms::label ||
tag == nsGkAtoms::legend)
return PR_TRUE;
} else if (aContent->IsNodeOfType(nsINode::eXUL)) {
// XUL label elements are never focusable, so we need to check for them
// explicitly before giving up.
if (aContent->Tag() == nsGkAtoms::label)
return PR_TRUE;
}
return PR_FALSE;

Просмотреть файл

@ -6,7 +6,7 @@
xmlns:html="http://www.w3.org/1999/xhtml">
<!-- bound to <description>s -->
<binding id="text-base" extends="chrome://global/content/bindings/general.xml#basecontrol">
<binding id="text-base">
<implementation implements="nsIDOMXULDescriptionElement, nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
@ -15,6 +15,10 @@
]]>
</getter>
</property>
<property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
else this.removeAttribute('disabled');
return val;"
onget="return this.getAttribute('disabled') == 'true';"/>
<property name="value" onget="return this.getAttribute('value');"
onset="this.setAttribute('value', val); return val;"/>
<property name="crop" onget="return this.getAttribute('crop');"