Skip to content

Commit 2590a24

Browse files
committed
Prioritize ignoring keyscroke from nested details
1 parent 24b7d3c commit 2590a24

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,12 @@ function commit(selected: Element, details: Element) {
216216

217217
function keydown(details: Element, menu: DetailsMenuElement, event: Event) {
218218
if (!(event instanceof KeyboardEvent)) return
219-
const state = states.get(menu)
220-
if (!state) return
221-
if (state.isComposing) return
222-
const isSummaryFocused = event.target instanceof Element && event.target.tagName === 'SUMMARY'
223-
224219
// Ignore key presses from nested details.
225220
if (details.querySelector('details[open]')) return
221+
const state = states.get(menu)
222+
if (!state || state.isComposing) return
223+
224+
const isSummaryFocused = event.target instanceof Element && event.target.tagName === 'SUMMARY'
226225

227226
switch (event.key) {
228227
case 'Escape':

0 commit comments

Comments
 (0)