Markdown source/preview toolbar toggle changes position when file has Git changes
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Yes (only the built-in Markdown and Git extensions are involved)
- VS Code Version: Code - OSS 1.134.0, commit `3e28a24456abff041d6ee809a33f24b37ab6a1a5`
- OS Version: macOS 26.6.1 (25G76), arm64
Steps to Reproduce:
1. Open a Git-tracked Markdown file in the text editor.
2. Modify the file so that it has working tree changes and the `Open Changes` editor-title action is visible.
3. Note the position of the `Open as Preview` action in the editor title.
4. Select `Open as Preview`.
5. Observe that `Open Changes` is now before `Reopen as source file`, so the source/preview toggle changes position.
Expected:
`Open as Preview` and `Reopen as source file` should occupy a stable position when switching between source and preview, including when the file has Git changes. This was the intent of #319723 and #319960.
Actual:
The toggle changes its position relative to `Open Changes`:
```text
Source editor: Open as Preview -> Open Changes
Preview editor: Open Changes -> Reopen as source file
```
This appears to happen because all three editor-title actions use the same `navigation@2` ordering:
- `markdown.reopenAsPreview`
- `markdown.reopenAsSource`
- `git.openChange`
When menu items have the same group and order, they are sorted by their original English titles. `Open as Preview` sorts before `Open Changes`, while `Reopen as source file` sorts after it. As a result, replacing the source action with the preview action swaps their relative positions.
Related: #319723, #319960
Contributor guide
Assessment
This issue has not been assessed yet.