diff --git a/srcts/src/components/card.ts b/srcts/src/components/card.ts index c19fea8a1..e4704c605 100644 --- a/srcts/src/components/card.ts +++ b/srcts/src/components/card.ts @@ -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();