Skip to content

VSCode extension: keyboard shortcuts (/, ctrl+p, ctrl+b, etc.) not working in webview panel #26519

Closed as not planned

Description

@akak2018

Description

Description

When using the OpenCode VSCode extension (not the terminal/TUI version),
keyboard shortcuts defined by OpenCode do not work because VS Code intercepts
them before they reach the webview panel.

Environment

  • OpenCode version: (your version)
  • VS Code version: (your version)
  • OS: Windows

Shortcuts affected

  • / (slash) — intercepted by VS Code comment action
  • ctrl+p — intercepted by VS Code "Go to File"
  • ctrl+b — intercepted by VS Code sidebar toggle
  • ctrl+j — intercepted by VS Code panel toggle
  • ctrl+r — intercepted by VS Code "Open Recent"
  • ctrl+z — intercepted by VS Code undo

Steps to reproduce

  1. Install the OpenCode VS Code extension
  2. Open the OpenCode panel
  3. Click inside the OpenCode webview to focus it
  4. Try pressing / or ctrl+p
  5. VS Code handles the shortcut instead of OpenCode

Expected behavior

Shortcuts should be captured by the OpenCode webview when it is focused.

Actual behavior

VS Code intercepts the keypresses and triggers its own commands instead.

Notes

This is a known VS Code webview limitation (microsoft/vscode#129178) but it
can be worked around by the extension using webview keyboard event handling.
Other extensions like Cline and Continue have implemented similar workarounds.
The terminalFocus when-condition does not apply here since the extension uses
a webview panel, not a terminal.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on May 9, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    For keybind-related issues, please also check our pinned keybinds documentation: #4997

  2. github-actions commented on Jul 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions