🎨 Palette: Add keyboard shortcuts for generation prompts#6294
🎨 Palette: Add keyboard shortcuts for generation prompts#6294EffortlessSteven wants to merge 1 commit into
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds a Ctrl+Enter (or Cmd+Enter) keyboard shortcut to submit prompts in the WASM browser examples, including visual indicators, accessibility attributes (aria-hidden and aria-keyshortcuts), and documentation. The review feedback points out that e.preventDefault() should be called unconditionally when the shortcut is triggered, preventing unwanted newlines from being inserted into the textarea even when the submit button is disabled.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const handleShortcut = (e, btnId) => { | ||
| if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') { | ||
| const btn = document.getElementById(btnId); | ||
| if (btn && !btn.disabled) { | ||
| e.preventDefault(); | ||
| btn.click(); | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
When the user presses Ctrl+Enter (or Cmd+Enter), the default behavior of inserting a newline in the textarea should be prevented regardless of whether the submit button is currently enabled or disabled.
If the button is disabled (e.g., during active text generation), not preventing the default action will result in unwanted newlines being appended to the prompt, which degrades the user experience.
| const handleShortcut = (e, btnId) => { | |
| if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') { | |
| const btn = document.getElementById(btnId); | |
| if (btn && !btn.disabled) { | |
| e.preventDefault(); | |
| btn.click(); | |
| } | |
| } | |
| }; | |
| const handleShortcut = (e, btnId) => { | |
| if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') { | |
| e.preventDefault(); | |
| const btn = document.getElementById(btnId); | |
| if (btn && !btn.disabled) { | |
| btn.click(); | |
| } | |
| } | |
| }; |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_fb265cb1-b996-4ba6-84aa-fb489f535e4c) |
💡 What: Added visual
<kbd>elements indicating thatCtrl+Entercan be used to submit prompts, and implemented the keyboard event listeners to support this shortcut across the Basic Inference, Streaming, and Web Workers tabs.🎯 Why: Textareas capture the
Enterkey for multiline input, meaning users have to switch from their keyboard to their mouse to click the "Generate" button. Adding a standardCtrl+Entershortcut makes the interface more keyboard-friendly and efficient.📸 Before/After: Visual shortcuts (
Ctrl+Enter) are now displayed next to the "Prompt" labels.♿ Accessibility: The visual
<kbd>elements are hidden from screen readers usingaria-hidden="true", while the actual textareas have been updated witharia-keyshortcuts="Control+Enter"to properly announce the shortcut to assistive technologies.PR created automatically by Jules for task 13938019123830368148 started by @EffortlessSteven
Note
Low Risk
Changes are limited to the WASM browser example UI and client-side event handlers; no inference, auth, or data-path changes.
Overview
Adds Ctrl+Enter (and Cmd+Enter on macOS) to submit prompts from the WASM browser demo without leaving the keyboard, on the Basic, Streaming, and Web Worker tabs.
The demo shows a styled Ctrl+Enter hint next to each prompt label and wires
setupKeyboardShortcuts()at startup so the shortcut clicks the same generate/stream/worker buttons when they are enabled. Textareas usearia-keyshortcuts="Control+Enter"while the visual<kbd>isaria-hiddenso screen readers are not doubled up.Documents the accessibility pattern in
.jules/palette.md.Reviewed by Cursor Bugbot for commit a77ece5. Bugbot is set up for automated code reviews on this repo. Configure here.