Markdown preview: no commands to scroll it, so keyboard scrolling can't be rebound (e.g. j/k)
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
- VS Code Version: 1.132.0 (df53daabb18cd157bdb08c7f01c34df936cf12f4, arm64)
- OS Version: macOS 26.5.2 (Apple Silicon)
### Summary
The Markdown preview exposes no commands for scrolling, so its scrolling cannot be driven by keybindings. Browser-native keys (arrows, `space`/`shift+space`, `PgUp`/`PgDn`, `Home`/`End`) work once the webview body has focus, but that set is fixed and unrebindable. There is no way to bind any other key to "scroll the preview".
### Steps to Reproduce
1. Open any `.md` file and run **Markdown: Open Preview** (or **Reopen Editor With… → Markdown Preview**).
2. Try to bind a key to scroll the preview, e.g.:
```jsonc
{
"key": "j",
"command": "",
"when": "activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"
}
```
3. There is nothing to put in `command`.
What I checked in 1.132.0:
- `markdown-language-features` contributes 16 commands (`markdown.showPreview`, `markdown.preview.refresh`, `markdown.preview.toggleLock`, `markdown.showSource`, `markdown.reopenAsPreview`, …). None of them scroll.
- Core contributes only `editor.action.webvieweditor.showFind` / `findNext` / `findPrevious` / `hideFind` for webview editors. No scroll commands.
### Request
Contribute scroll commands for the Markdown preview — or, more generally, for webview editors, which would cover this and every other webview-based editor at once. Something along the lines of:
- `markdown.preview.scrollLineDown` / `scrollLineUp`
- `markdown.preview.scrollPageDown` / `scrollPageUp`
- `markdown.preview.scrollToTop` / `scrollToBottom`
The context keys needed to scope such keybindings already exist and work today (`activeWebviewPanelId == 'markdown.preview'` for **Open Preview**, `activeCustomEditorId == 'vscode.markdown.preview.editor'` for the custom editor), so only the commands themselves are missing.
### Motivation
Every other scrollable surface in VS Code can be driven by keybindings — text editors have `scrollLineDown`/`scrollLineUp`/`scrollPageDown`/`scrollPageUp`, lists have `list.focusDown`/`list.focusUp`, notebooks and the terminal have their own. The Markdown preview is the one place where scrolling is reachable only through a hardcoded key set.
This is most visible for Vim-style users who want `j`/`k`, `ctrl+d`/`ctrl+u`, `gg`/`G` to work in the preview. Extensions cannot fill the gap: VSCodeVim's keybindings are all gated on `editorTextFocus && vim.active`, and a webview satisfies neither, so the preview is a dead zone for motion keys. It also affects anyone with a non-default scrolling scheme, and anyone who cannot comfortably reach the arrow/page keys.
Other keybindings *do* fire while the preview is focused — binding `ctrl+l` to `workbench.action.navigateRight` scoped to the context keys above works fine, as does the built-in `shift+cmd+v` → `markdown.togglePreview` on `activeCustomEditorId == 'vscode.markdown.preview.editor'`. So key dispatch into the preview already works; the only missing piece is a command that scrolls.
Contributor guide
Assessment
This issue has not been assessed yet.