Skip to content

fix: focus the panel when it opens so escape and space work - #17

Merged
nabheet merged 1 commit into
mainfrom
fix/focus-on-open
Nov 20, 2026
Merged

nabheet merged 1 commit into
mainfrom
fix/focus-on-open

Conversation

@nabheet

@nabheet nabheet commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Problem

A panel opened from the prompt owned no keys. escape did not close it, space did not pause, f did nothing — the panel only responded after it was clicked.

Keymap layers are routed to the focused renderable (target, mode, priority in KeymapLayer). The host focuses the pane, but the panel contribution never took focus, so its layer was mounted and never reached.

Fix

onMount(() => props.panel.focus()) in MediaPanel. Opening a panel is an explicit user request, so taking focus matches what the user just asked for; clicking elsewhere still releases it.

Verification

Clean session, real keystrokes, local checkout, 40s: /media opens the panel (5 draws observed), it animates, and escape at the end leaves the screen with no panel — no click.

Before the fix the same sequence left the panel open, which is the behaviour you reported.

Keymap layers are routed to the focused renderable. A panel opened from the
prompt owned no keys until it was clicked: escape did nothing, space did
nothing, and the panel looked unresponsive even though its ticker ran.

MediaPanel now focuses the panel on mount. Verified by driving keystrokes on a
clean session: the panel opens with /media, animates, and closes on escape
without any click.
@github-actions

Copy link
Copy Markdown

Beta prerelease published: 0.1.0-beta.43. Install with npm i opencode-media-panel@beta.

@nabheet
nabheet merged commit 247e042 into main Nov 20, 2026
3 checks passed
@nabheet
nabheet deleted the fix/focus-on-open branch November 20, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant