Skip to content

Commit

Permalink
Exclude hidden nodes from accessibility tree
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Oct 21, 2019
1 parent 6c2095d commit 17248e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/Accessibility.js
Expand Up @@ -143,6 +143,7 @@ class AXNode {
this._editable = false;
this._focusable = false;
this._expanded = false;
this._hidden = false;
this._name = this._payload.name ? this._payload.name.value : '';
this._role = this._payload.role ? this._payload.role.value : 'Unknown';
this._cachedHasFocusableChild;
Expand All @@ -156,6 +157,8 @@ class AXNode {
this._focusable = property.value.value;
if (property.name === 'expanded')
this._expanded = property.value.value;
if (property.name === 'hidden')
this._hidden = property.value.value;
}
}

Expand Down Expand Up @@ -289,7 +292,7 @@ class AXNode {
*/
isInteresting(insideControl) {
const role = this._role;
if (role === 'Ignored')
if (role === 'Ignored' || this._hidden)
return false;

if (this._focusable || this._richlyEditable)
Expand Down
1 change: 0 additions & 1 deletion test/accessibility.spec.js
Expand Up @@ -71,7 +71,6 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
{role: 'textbox', name: 'Input with whitespace', value: ' '},
{role: 'textbox', name: '', value: 'value only'},
{role: 'textbox', name: 'placeholder', value: 'and a value'},
{role: 'text', name: 'This is a description!'},
{role: 'textbox', name: 'placeholder', value: 'and a value', description: 'This is a description!'},
{role: 'combobox', name: '', value: 'First Option', children: [
{role: 'menuitem', name: 'First Option', selected: true},
Expand Down

0 comments on commit 17248e4

Please sign in to comment.