mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1199884 - Keep match roles empty in BaseTraversalRules that don't provide roles. r=yzen
This commit is contained in:
parent
6bf6268612
commit
17f9630967
@ -29,21 +29,23 @@ let gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images')
|
||||
function BaseTraversalRule(aRoles, aMatchFunc, aPreFilter) {
|
||||
this._explicitMatchRoles = new Set(aRoles);
|
||||
this._matchRoles = aRoles;
|
||||
if (aRoles.indexOf(Roles.LABEL) < 0) {
|
||||
this._matchRoles.push(Roles.LABEL);
|
||||
}
|
||||
if (aRoles.indexOf(Roles.INTERNAL_FRAME) < 0) {
|
||||
// Used for traversing in to child OOP frames.
|
||||
this._matchRoles.push(Roles.INTERNAL_FRAME);
|
||||
if (aRoles.length) {
|
||||
if (aRoles.indexOf(Roles.LABEL) < 0) {
|
||||
this._matchRoles.push(Roles.LABEL);
|
||||
}
|
||||
if (aRoles.indexOf(Roles.INTERNAL_FRAME) < 0) {
|
||||
// Used for traversing in to child OOP frames.
|
||||
this._matchRoles.push(Roles.INTERNAL_FRAME);
|
||||
}
|
||||
}
|
||||
this._matchFunc = aMatchFunc || function() { return Filters.MATCH; };
|
||||
this.preFilter = aPreFilter || gSimplePreFilter;
|
||||
}
|
||||
|
||||
BaseTraversalRule.prototype = {
|
||||
getMatchRoles: function BaseTraversalRule_getmatchRoles(aRules) {
|
||||
aRules.value = this._matchRoles;
|
||||
return aRules.value.length;
|
||||
getMatchRoles: function BaseTraversalRule_getmatchRoles(aRoles) {
|
||||
aRoles.value = this._matchRoles;
|
||||
return aRoles.value.length;
|
||||
},
|
||||
|
||||
match: function BaseTraversalRule_match(aAccessible)
|
||||
@ -54,8 +56,9 @@ BaseTraversalRule.prototype = {
|
||||
Filters.MATCH | Filters.IGNORE_SUBTREE : Filters.IGNORE;
|
||||
}
|
||||
|
||||
let matchResult = this._explicitMatchRoles.has(role) ?
|
||||
this._matchFunc(aAccessible) : Filters.IGNORE;
|
||||
let matchResult =
|
||||
(this._explicitMatchRoles.has(role) || !this._explicitMatchRoles.size) ?
|
||||
this._matchFunc(aAccessible) : Filters.IGNORE;
|
||||
|
||||
// If we are on a label that nests a checkbox/radio we should land on it.
|
||||
// It is a bigger touch target, and it reduces clutter.
|
||||
|
@ -10,55 +10,58 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3 id="heading-1">A small first heading</h3>
|
||||
<form>
|
||||
<label for="input-1-1">Name:</label>
|
||||
<input id="input-1-1">
|
||||
<label id="label-1-2">Favourite Ice Cream Flavour:<input id="input-1-2"></label>
|
||||
<button id="button-1-1">Magic Button</button>
|
||||
<label for="radio-1-1">Radios are old: </label>
|
||||
<input id="radio-1-1" type="radio">
|
||||
<label for="radio-1-2">Radios are new: </label>
|
||||
<input id="radio-1-2" type="radio">
|
||||
<label for="input-1-3">Password:</label>
|
||||
<input id="input-1-3" type="password">
|
||||
<label for="input-1-4">Unlucky number:</label>
|
||||
<input id="input-1-4" type="tel">
|
||||
<input id="button-1-2" type="button" value="Fun">
|
||||
<label for="checkbox-1-1">Check me: </label>
|
||||
<input id="checkbox-1-1" type="checkbox">
|
||||
<select id="select-1-1">
|
||||
<option>Value 1</option>
|
||||
<option>Value 2</option>
|
||||
<option>Value 3</option>
|
||||
</select>
|
||||
<select id="select-1-2" multiple="true">
|
||||
<option>Value 1</option>
|
||||
<option>Value 2</option>
|
||||
<option>Value 3</option>
|
||||
</select>
|
||||
<label for="checkbox-1-2">Check me too: </label>
|
||||
<input id="checkbox-1-2" type="checkbox">
|
||||
<label for="checkbox-1-3">But not me: </label>
|
||||
<input id="checkbox-1-3" type="checkbox" aria-hidden="true">
|
||||
<label for="checkbox-1-4">Or me! </label>
|
||||
<input id="checkbox-1-4" type="checkbox" style="visibility:hidden">
|
||||
<select id="select-1-3" size="3">
|
||||
<option>Value 1</option>
|
||||
<option>Value 2</option>
|
||||
<option>Value 3</option>
|
||||
</select>
|
||||
<label for="input-1-5">Electronic mailing address:</label>
|
||||
<input id="input-1-5" type="email">
|
||||
<input id="button-1-3" type="submit" value="Submit">
|
||||
|
||||
</form>
|
||||
<h2 id="heading-2">A larger second</h2>
|
||||
<div id="heading-3" role="heading">ARIA is fun</div>
|
||||
<input id="button-2-1" type="button" value="More Fun">
|
||||
<div id="button-2-2" tabindex="0" role="button">ARIA fun</div>
|
||||
<div id="button-2-3" tabindex="0" role="button" aria-pressed="false">My little togglebutton</div>
|
||||
<div id="button-2-4" tabindex="0" role="spinbutton">ARIA fun</div>
|
||||
<header id="header-1">
|
||||
<h3 id="heading-1">A small first heading</h3>
|
||||
<form>
|
||||
<label for="input-1-1">Name:</label>
|
||||
<input id="input-1-1">
|
||||
<label id="label-1-2">Favourite Ice Cream Flavour:<input id="input-1-2"></label>
|
||||
<button id="button-1-1">Magic Button</button>
|
||||
<label for="radio-1-1">Radios are old: </label>
|
||||
<input id="radio-1-1" type="radio">
|
||||
<label for="radio-1-2">Radios are new: </label>
|
||||
<input id="radio-1-2" type="radio">
|
||||
<label for="input-1-3">Password:</label>
|
||||
<input id="input-1-3" type="password">
|
||||
<label for="input-1-4">Unlucky number:</label>
|
||||
<input id="input-1-4" type="tel">
|
||||
<input id="button-1-2" type="button" value="Fun">
|
||||
<label for="checkbox-1-1">Check me: </label>
|
||||
<input id="checkbox-1-1" type="checkbox">
|
||||
<select id="select-1-1">
|
||||
<option>Value 1</option>
|
||||
<option>Value 2</option>
|
||||
<option>Value 3</option>
|
||||
</select>
|
||||
<select id="select-1-2" multiple="true">
|
||||
<option>Value 1</option>
|
||||
<option>Value 2</option>
|
||||
<option>Value 3</option>
|
||||
</select>
|
||||
<label for="checkbox-1-2">Check me too: </label>
|
||||
<input id="checkbox-1-2" type="checkbox">
|
||||
<label for="checkbox-1-3">But not me: </label>
|
||||
<input id="checkbox-1-3" type="checkbox" aria-hidden="true">
|
||||
<label for="checkbox-1-4">Or me! </label>
|
||||
<input id="checkbox-1-4" type="checkbox" style="visibility:hidden">
|
||||
<select id="select-1-3" size="3">
|
||||
<option>Value 1</option>
|
||||
<option>Value 2</option>
|
||||
<option>Value 3</option>
|
||||
</select>
|
||||
<label for="input-1-5">Electronic mailing address:</label>
|
||||
<input id="input-1-5" type="email">
|
||||
<input id="button-1-3" type="submit" value="Submit">
|
||||
</form>
|
||||
</header>
|
||||
<main id="main-1">
|
||||
<h2 id="heading-2">A larger second</h2>
|
||||
<div id="heading-3" role="heading">ARIA is fun</div>
|
||||
<input id="button-2-1" type="button" value="More Fun">
|
||||
<div id="button-2-2" tabindex="0" role="button">ARIA fun</div>
|
||||
<div id="button-2-3" tabindex="0" role="button" aria-pressed="false">My little togglebutton</div>
|
||||
<div id="button-2-4" tabindex="0" role="spinbutton">ARIA fun</div>
|
||||
</main>
|
||||
<h1 id="heading-4" style="display:none">Invisible header</h1>
|
||||
<dl id="list-1">
|
||||
<dt id="listitem-1-1">Programming Language</dt>
|
||||
@ -141,8 +144,10 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="statusbar-1" role="status">Last sync:<span>2 days ago</span></div>
|
||||
<div aria-label="Last sync: 30min ago" id="statusbar-2" role="status"></div>
|
||||
<footer id="footer-1">
|
||||
<div id="statusbar-1" role="status">Last sync:<span>2 days ago</span></div>
|
||||
<div aria-label="Last sync: 30min ago" id="statusbar-2" role="status"></div>
|
||||
</footer>
|
||||
|
||||
<span id="switch-1" role="switch" aria-checked="false" aria-label="Light switch"></span>
|
||||
<p>This is a MathML formula <math id="math-1" display="block">
|
||||
|
@ -127,6 +127,9 @@
|
||||
'switch-1', 'This is a MathML formula ', 'math-1',
|
||||
'with some text after.']);
|
||||
|
||||
queueTraversalSequence(gQueue, docAcc, TraversalRules.Landmark, null,
|
||||
['header-1', 'main-1', 'footer-1']);
|
||||
|
||||
gQueue.invoke();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user