Skip to content

Commit

Permalink
ARIA 1.0 Combobox Example: Make escape clear textbox (pull #734)
Browse files Browse the repository at this point in the history
Fixes issue #559 by both closing pop-up if open and clearing textbox when escape key is pressed when focus is in the textbox.
  • Loading branch information
mcking65 committed Jun 27, 2018
1 parent 8bc433e commit efcd04e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions examples/combobox/aria1.0pattern/js/combobox-1.0-list.js
Expand Up @@ -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;

Expand Down Expand Up @@ -242,6 +240,9 @@ ComboboxList.prototype.handleKeyup = function (event) {
this.option = false;
}

if (event.keyCode === this.keyCode.ESC) {
return;
}

switch (event.keyCode) {

Expand Down

0 comments on commit efcd04e

Please sign in to comment.