Skip to content

Commit 097c8c4

Browse files
committed
fix: only apply specific c shortcut on package page
1 parent 1963a24 commit 097c8c4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/components/AppHeader.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ onKeyStroke(
7676
onKeyStroke(
7777
'c',
7878
e => {
79+
// Allow more specific handlers to take precedence
80+
if (e.defaultPrevented) return
81+
7982
// Don't trigger if user is typing in an input
8083
const target = e.target as HTMLElement
8184
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {

app/pages/[...package].vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,9 @@ onKeyStroke(
338338
{ dedupe: true },
339339
)
340340
341-
onKeyStroke('c', () => {
341+
onKeyStroke('c', e => {
342342
if (pkg.value) {
343+
e.preventDefault()
343344
router.push({ path: '/compare', query: { packages: pkg.value.name } })
344345
}
345346
})

0 commit comments

Comments
 (0)