From bbfe67943c074bee9ee0d8de47527c1bd139fa9a Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Fri, 6 Mar 2020 15:02:29 +0100 Subject: [PATCH] Make escape hide the popup if it's shown, regardless of where focus is Update the corresponding test to no longer expect a failure. Fixes #860. --- examples/combobox/js/grid-combo.js | 8 ++++---- test/tests/combobox_grid-combo.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/combobox/js/grid-combo.js b/examples/combobox/js/grid-combo.js index 061c43af8c..489bb781b2 100644 --- a/examples/combobox/js/grid-combo.js +++ b/examples/combobox/js/grid-combo.js @@ -94,16 +94,16 @@ aria.GridCombobox.prototype.handleInputKeyDown = function (evt) { ); } else { - if (aria.Utils.hasClass(this.grid, 'hidden')) { + if (!this.shown) { setTimeout((function () { // On Firefox, input does not get cleared here unless wrapped in // a setTimeout this.input.value = ''; }).bind(this), 1); } - else { - this.hideResults(); - } + } + if (this.shown) { + this.hideResults(); } return; } diff --git a/test/tests/combobox_grid-combo.js b/test/tests/combobox_grid-combo.js index e665c2f226..0498541956 100644 --- a/test/tests/combobox_grid-combo.js +++ b/test/tests/combobox_grid-combo.js @@ -544,7 +544,7 @@ ariaTest('Test double escape key press with focus on combobox', // This test fails due to bug: https://github.com/w3c/aria-practices/issues/860 -ariaTest.failing('Test escape key press with focus on popup', +ariaTest('Test escape key press with focus on popup', exampleFile, 'popup-key-escape', async (t) => { t.plan(2);