···1515 if (!ref.current || !hasPriority) return;
16161717 function onKey(event: KeyboardEvent) {
1818- if (event.defaultPrevented || event.isComposing) return;
1919-2020- if (event.code === 'Escape') {
1818+ if (!event.isComposing && event.code === 'Escape') {
2119 // The current dialog can be dismissed by pressing escape if it either has focus
2220 // or it has priority
2321 const active = document.activeElement;