Bug 1316965: Give file inputs an a11y role of GROUPING so screen readers report their label when focus enters them. r=MarcoZ

Differential Revision: https://phabricator.services.mozilla.com/D46375

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2019-09-19 04:39:21 +00:00
parent 90f724704e
commit 79314daf0b
4 changed files with 7 additions and 9 deletions

View File

@ -410,9 +410,9 @@ HTMLFileInputAccessible::HTMLFileInputAccessible(nsIContent* aContent,
}
role HTMLFileInputAccessible::NativeRole() const {
// JAWS wants a text container, others don't mind. No specific role in
// AT APIs.
return roles::TEXT_CONTAINER;
// No specific role in AT APIs. We use GROUPING so that the label will be
// reported by screen readers when focus enters this control .
return roles::GROUPING;
}
nsresult HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent) {

View File

@ -704,7 +704,7 @@
// HTML:input@type="file"
obj = {
TEXT_CONTAINER: [
GROUPING: [
{ role: ROLE_PUSHBUTTON },
{ role: ROLE_LABEL },
],

View File

@ -50,10 +50,8 @@
testRole("head5", ROLE_HEADING);
testRole("head6", ROLE_HEADING);
// Test that an html:input @type="file" is exposed as ROLE_TEXT_CONTAINER.
// After fix for bug 471356, it was temporarily exposed as a paragraph,
// breaking JAWS compatibility.
testRole("data", ROLE_TEXT_CONTAINER);
// Test that an html:input @type="file" is exposed as ROLE_GROUPING.
testRole("data", ROLE_GROUPING);
// Test that input type="checkbox" and type="radio" are
// exposed as such regardless of appearance style.

View File

@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
<script type="application/javascript">
function doTest() {
var accTree = {
role: ROLE_TEXT_CONTAINER,
role: ROLE_GROUPING,
children: [
{
role: ROLE_PUSHBUTTON,