Skip to content

Commit

Permalink
Don't exit when select input is open and focused
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed May 12, 2023
1 parent 6bcb9a8 commit 81704a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions srcts/src/components/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ class Card {
}

private _exitFullScreenOnEscape(event: KeyboardEvent): void {
// if a select input element has focus, then don't exit full screen
if (document.activeElement instanceof HTMLSelectElement) {
return;
}
if (!(event.target instanceof HTMLElement)) return;
// If the user is in the middle of a select input choice, don't exit
const selOpenSelectInput = ["select[open]", "input[aria-expanded='true']"];
if (event.target.matches(selOpenSelectInput.join(", "))) return;

if (event.key === "Escape") {
this.exitFullScreen();
Expand Down

0 comments on commit 81704a7

Please sign in to comment.