You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a menu button at the top right of each code block with "Change language" and "Copy code" actions. With the caret in a code block, Mod-/ opens the menu, so the language can be changed from the keyboard only. When the menu or the language picker closes, focus goes back to the editor. The language picker now highlights the first match automatically, so Enter picks it.
The React code block toolbar adds a menu that opens with Mod-/. The menu provides language selection and code copying. Popup state tracks opening, closing, and focus return. Core shortcut documentation and release metadata are updated.
The React extension registers Mod-/ to open the menu for the code block containing the caret. Core shortcut documentation and its snapshot include the shortcut. The changeset records patch and minor releases for the core and React packages.
Popup state and focus management packages/react/src/components/code-block-toolbar-state.ts, packages/react/src/components/code-block-toolbar-state.test.ts, packages/react/src/components/code-block-view.tsx
The reducer tracks the open popup, popups completing their exit animations, and the focus destination. The toolbar controls the menu and language picker, including popup handoff and focus return.
Menu actions and clipboard handling packages/react/src/components/code-block-view.tsx, packages/react/src/components/code-block-view.test.tsx, packages/react/src/components/code-block-view.module.css, packages/react/src/components/code-block-view.module.d.css.ts, packages/react/src/utils/write-clipboard-text.ts, packages/react/src/components/copy-button.tsx, packages/react/src/components/markdown-view.tsx
The menu provides Change language and Copy code actions. Clipboard writes use a shared helper. Component tests cover menu interaction, language selection, copying, and focus behavior. Menu styles and style-map keys are added. Mermaid preview classes now use clsx.
sequenceDiagram
participant Editor
participant Keymap
participant CodeBlockToolbar
participant Menu
participant LanguagePicker
participant Clipboard
Editor->>Keymap: Mod-/ with caret in code block
Keymap->>CodeBlockToolbar: Open registered menu
CodeBlockToolbar->>Menu: Open menu and set focus return
Menu->>LanguagePicker: Change language action
Menu->>Clipboard: Copy code action
Loading
Merge Risk: Low · up to 4bd0f
The menu has bounded issues: outside dismissal can steal focus, failed copying gives no feedback, and read-only editors permit language changes. An unusual programmatic shortcut sequence can target the previous block, and core-only users see an unavailable shortcut advertised. These warrant fixes or explicit owner acceptance, but do not establish broad release-blocking failure.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a menu button at the top right of each code block with "Change language" and "Copy code" actions. With the caret in a code block,
Mod-/opens the menu, so the language can be changed from the keyboard only. When the menu or the language picker closes, focus goes back to the editor. The language picker now highlights the first match automatically, so Enter picks it.For team-reflect/reflect-open#2038
code-block-menu.mp4
Summary by CodeRabbit