From efcd04e59cee8a5ed71a02b2363252d5ae24ee02 Mon Sep 17 00:00:00 2001 From: Matt King Date: Tue, 26 Jun 2018 23:27:54 -0700 Subject: [PATCH] ARIA 1.0 Combobox Example: Make escape clear textbox (pull #734) Fixes issue #559 by both closing pop-up if open and clearing textbox when escape key is pressed when focus is in the textbox. --- .../combobox/aria1.0pattern/js/combobox-1.0-list.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/combobox/aria1.0pattern/js/combobox-1.0-list.js b/examples/combobox/aria1.0pattern/js/combobox-1.0-list.js index ad6cf4afb3..28f6395a85 100644 --- a/examples/combobox/aria1.0pattern/js/combobox-1.0-list.js +++ b/examples/combobox/aria1.0pattern/js/combobox-1.0-list.js @@ -193,12 +193,10 @@ ComboboxList.prototype.handleKeydown = function (event) { break; case this.keyCode.ESC: - if (this.listbox.hasFocus) { - this.listbox.close(true); - this.setVisualFocusTextbox(); - this.setValue(''); - this.option = false; - } + this.listbox.close(true); + this.setVisualFocusTextbox(); + this.setValue(''); + this.option = false; flag = true; break; @@ -242,6 +240,9 @@ ComboboxList.prototype.handleKeyup = function (event) { this.option = false; } + if (event.keyCode === this.keyCode.ESC) { + return; + } switch (event.keyCode) {