Repository navigation
Fix Space key activating header buttons instead of PTT in voice mode - #321164
Merged
Merged
Conversation
Megan Rogge (meganrogge)
marked this pull request as draft
June 12, 2026 14:52
Megan Rogge (meganrogge)
force-pushed
the
meganrogge/fix-space-miniview
branch
from
June 12, 2026 14:53
3335202 to
7352170
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an input-handling conflict in the Agents Voice widget where pressing Space could trigger the browser’s native “click” behavior on focused header controls instead of reliably mapping to push-to-talk (PTT).
Changes:
- Adds a
keydownhandler on the widget container topreventDefault()for Space (outside of text inputs) so Space won’t activate focused header buttons. - Keeps PTT release behavior on
keyupas before, relying on theagentsVoice.pushToTalkkeybinding for the keydown behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts | Prevents Space default behavior within the voice widget so Space consistently maps to PTT rather than activating header controls. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts:177
- The new
keydownlistener is added directly viaaddEventListenerbut never removed on widget disposal. Since this widget’sdispose()keeps the container element around (it just re-rendersnothing), the handler can leakthis.callbacks/widget state and may cause duplicate handling if the widget is re-created on the same container. Consider registering both thekeydownandkeyuphandlers for disposal (same issue applies to the existingkeyuplistener).
this.container.addEventListener('keydown', (e: KeyboardEvent) => {
if (e.code === 'Space' && !_isTextInput(e.target)) {
e.preventDefault();
}
});
// keyup listener for hold-to-talk release — the keydown is
// handled by the registered Space keybinding (agentsVoice.pushToTalk).
this.container.addEventListener('keyup', (e: KeyboardEvent) => {
if (e.code === 'Space' && !_isTextInput(e.target)) {
e.preventDefault();
this.callbacks.pttUp();
}
});
- Files reviewed: 2/2 changed files
- Comments generated: 0
Megan Rogge (meganrogge)
marked this pull request as ready for review
June 12, 2026 14:55
Megan Rogge (meganrogge)
enabled auto-merge (squash)
June 12, 2026 14:55
Megan Rogge (meganrogge)
marked this pull request as draft
June 12, 2026 14:55
auto-merge was automatically disabled
June 12, 2026 14:55
Pull request was converted to draft
Three issues caused Space to misbehave in voice mode: 1. The pushToTalk action called toggleWindow() to open the aux window. Since the keybinding only fires when AGENTS_VOICE_WIDGET_FOCUSED, the UI is already visible. Removed the toggleWindow() call. 2. When a header button had keyboard focus, pressing Space triggered the browser's native click on that button. Added keydown/keyup listeners that track the PTT key and preventDefault on it. 3. The keyup handler was hardcoded to Space, so rebinding PTT to another key would break hold-to-talk release. Now captures the actual key code from the document keydown (capture phase) when pttDown fires, and matches that code on keyup. Co-authored-by: Copilot <[email protected]>
Megan Rogge (meganrogge)
force-pushed
the
meganrogge/fix-space-miniview
branch
from
June 12, 2026 14:58
7352170 to
fa39ce7
Compare
Megan Rogge (meganrogge)
marked this pull request as ready for review
June 12, 2026 15:02
Megan Rogge (meganrogge)
enabled auto-merge (squash)
June 12, 2026 15:02
Benjamin Christopher Simmonds (benibenj)
approved these changes
Jun 12, 2026
Megan Rogge (meganrogge)
added a commit
that referenced
this pull request
Jun 12, 2026
- Remove toggleWindow() call from pushToTalk action (prevents Space from opening the mini aux window) - Add dynamic PTT key tracking: captures last keydown code at document level, snapshots it on pttDown, matches on keyup — works with any rebound key, not just hardcoded Space - Add keydown preventDefault to block role='button' click activation during hold-to-talk Co-authored-by: Copilot <[email protected]>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When a header button (mini-view, feedback, etc.) had keyboard focus, pressing Space triggered the browser's native click on that button instead of activating push-to-talk. This happened because
role="button"elements fireclickon Space keydown by default.Adds a
keydownlistener on the voice widget container that prevents the default Space behavior, ensuring Space always maps to PTT via theagentsVoice.pushToTalkkeybinding. Buttons remain keyboard-navigable and activatable via Enter.