Skip to content

Commit af31ca9

Browse files
committed
fix: undo overeager new escape hatch
1 parent 4081cc9 commit af31ca9

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

app/pages/search.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,6 @@ function focusSearchInput() {
464464
}
465465
466466
function handleResultsKeydown(e: KeyboardEvent) {
467-
// Escape returns focus to the search input from anywhere on the page
468-
if (e.key === 'Escape') {
469-
e.preventDefault()
470-
focusSearchInput()
471-
return
472-
}
473-
474467
// If the active element is an input, navigate to exact match or wait for results
475468
if (e.key === 'Enter' && document.activeElement?.tagName === 'INPUT') {
476469
// Get value directly from input (not from route query, which may be debounced)
@@ -530,7 +523,7 @@ function handleResultsKeydown(e: KeyboardEvent) {
530523
}
531524
}
532525
533-
onKeyDown(['ArrowDown', 'ArrowUp', 'Enter', 'Escape'], handleResultsKeydown)
526+
onKeyDown(['ArrowDown', 'ArrowUp', 'Enter'], handleResultsKeydown)
534527
535528
useSeoMeta({
536529
title: () =>

test/e2e/interactions.spec.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,6 @@ test.describe('Search Pages', () => {
116116
await expect(page.locator('input[type="search"]')).toBeFocused()
117117
})
118118

119-
test('/search?q=vue → Escape returns focus to search input', async ({ page, goto }) => {
120-
await goto('/search?q=vue', { waitUntil: 'hydration' })
121-
122-
await expect(page.locator('text=/found \\d+|showing \\d+/i').first()).toBeVisible({
123-
timeout: 15000,
124-
})
125-
126-
// Navigate into results
127-
await page.keyboard.press('ArrowDown')
128-
await page.keyboard.press('ArrowDown')
129-
await expect(page.locator('[data-result-index="1"]').first()).toBeFocused()
130-
131-
// Escape returns to the search input
132-
await page.keyboard.press('Escape')
133-
await expect(page.locator('input[type="search"]')).toBeFocused()
134-
})
135-
136119
test('/search?q=vue → "/" focuses the search input from results', async ({ page, goto }) => {
137120
await goto('/search?q=vue', { waitUntil: 'hydration' })
138121

0 commit comments

Comments
 (0)