Skip to content

Commit

Permalink
Merge pull request #261 from gnbm/IssueESC
Browse files Browse the repository at this point in the history
Handle the Escape key when showing the dropbox as a popup, closing it
  • Loading branch information
gnbm authored Jun 17, 2023
2 parents de6fea4 + 46196e9 commit 6803a07
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist-archive/virtual-select-1.0.38.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions dist/virtual-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,11 @@ var VirtualSelect = /*#__PURE__*/function () {
this.closeDropbox();
return;
}
// Handle the Escape key when showing the dropdown as a popup, closing it
if (document.activeElement === this.$wrapper && (key === 27 || e.key === 'Escape') && this.showAsPopup) {
this.closeDropbox();
return;
}
if (method) {
this[method](e);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/virtual-select.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/assets/virtual-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,11 @@ var VirtualSelect = /*#__PURE__*/function () {
this.closeDropbox();
return;
}
// Handle the Escape key when showing the dropdown as a popup, closing it
if (document.activeElement === this.$wrapper && (key === 27 || e.key === 'Escape') && this.showAsPopup) {
this.closeDropbox();
return;
}
if (method) {
this[method](e);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/virtual-select.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/virtual-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,11 @@ export class VirtualSelect {
this.closeDropbox();
return;
}

// Handle the Escape key when showing the dropdown as a popup, closing it
if (document.activeElement === this.$wrapper && (key === 27 || e.key === 'Escape') && this.showAsPopup) {
this.closeDropbox();
return;
}
if (method) {
this[method](e);
}
Expand Down

0 comments on commit 6803a07

Please sign in to comment.