From 17248e4400b8fa260f9e64db09a436475471b11e Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Mon, 21 Oct 2019 11:02:58 +0200 Subject: [PATCH] Exclude hidden nodes from accessibility tree --- lib/Accessibility.js | 5 ++++- test/accessibility.spec.js | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Accessibility.js b/lib/Accessibility.js index 419e59fd2ed22..9f005a06b2e35 100644 --- a/lib/Accessibility.js +++ b/lib/Accessibility.js @@ -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; @@ -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; } } @@ -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) diff --git a/test/accessibility.spec.js b/test/accessibility.spec.js index 60b8ef847d699..a284d493caf73 100644 --- a/test/accessibility.spec.js +++ b/test/accessibility.spec.js @@ -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},