Skip to content

Commit e01ac54

Browse files
sairithik9849claude
andcommitted
fix: restore Escape-to-back on skill detail page
Escape was dropped when SkillDetail moved from a slide-over panel (Escape -> onClose) to full-page routing (onBack) in cf9cc31 and never got wired back up. Also guards SkillFileViewer's existing Escape handler against Radix dialogs (Cmd+K, Manage Folders) that preventDefault but don't stopPropagation, which would otherwise dismiss the dialog and navigate back in one keypress. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017LKjJ7DNYh5G575m1YzeYp
1 parent 411ebe1 commit e01ac54

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/renderer/src/views/SkillDetail.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMemo } from 'react'
1+
import { useEffect, useMemo } from 'react'
22
import { useQuery } from '@tanstack/react-query'
33
import { AlertTriangle, ArrowLeft, FolderOpen, Power } from 'lucide-react'
44
import { LintFindingsPanel } from '@/components/LintFindingsPanel'
@@ -39,6 +39,15 @@ export function SkillDetail({
3939
const metadataEntries = useMemo(() => parseMetadataEntries(data?.skill.metadata_json), [data])
4040
const hookEvents = parseHookEvents(data?.skill.hook_events).join(', ')
4141

42+
useEffect(() => {
43+
function handleKeyDown(event: KeyboardEvent): void {
44+
if (event.key !== 'Escape' || event.defaultPrevented) return
45+
onBack()
46+
}
47+
document.addEventListener('keydown', handleKeyDown)
48+
return () => document.removeEventListener('keydown', handleKeyDown)
49+
}, [onBack])
50+
4251
if (isPending) {
4352
return (
4453
<div className="flex flex-1 items-center justify-center text-sm text-muted-foreground">

src/renderer/src/views/SkillFileViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function SkillFileViewer({
4242

4343
useEffect(() => {
4444
function handleKeyDown(event: KeyboardEvent): void {
45-
if (event.key !== 'Escape') return
45+
if (event.key !== 'Escape' || event.defaultPrevented) return
4646
if (searchQuery) {
4747
setSearchQuery('')
4848
return

0 commit comments

Comments
 (0)