Skip to content

Fix keyboard activation of the voice input mode microphone button - #328768

Draft
meganrogge with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-fancy-animated-button
Draft

Fix keyboard activation of the voice input mode microphone button#328768
meganrogge with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-fancy-animated-button

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

The segmented voice input mode control (dictation / voice / listen cells) could not be started or stopped with the keyboard: focusing a cell and pressing Enter/Space did nothing.

Root cause: the cells are <button> elements inside a toolbar's ActionBar. The ActionBar's KEY_DOWN handler intercepts Enter/Space, runs the item's action — the no-op placeholder ChatVoiceInputModeAction.run() — and calls preventDefault()/stopPropagation(), swallowing the native button activation before the cell's own gesture can run. (This also produced the two focus stops testers observed: the ActionBar action-item and the inner button.)

Change (voiceInputModeActionViewItem.ts):

  • Added _registerActivationKeys(cell, handler) — an Enter/Space KEY_DOWN listener that stops the event before it reaches the ActionBar and invokes the same handler as the click gesture.
  • Wired it to all three cells: dictation → _onClickDictation, voice → _onClickVoicePowerToggle, listen → _onClickListen.
private _registerActivationKeys(cell: HTMLElement, handler: () => void): void {
    this._register(dom.addStandardDisposableListener(cell, dom.EventType.KEY_DOWN, e => {
        if (e.equals(KeyCode.Enter) || e.equals(KeyCode.Space)) {
            e.preventDefault();
            e.stopPropagation();
            handler();
        }
    }));
}

Enter/Space now activate the focused cell, complementing the existing keybindings. Mouse/pointer and hold-to-talk behavior are unchanged.

Copilot AI requested review from Copilot and removed request for Copilot August 3, 2026 17:39
Copilot AI linked an issue Aug 3, 2026 that may be closed by this pull request
…n cells

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot August 3, 2026 17:43
Copilot AI changed the title [WIP] Fix keyboard controls for fancy animated button Fix keyboard activation of the voice input mode microphone button Aug 3, 2026
Copilot AI requested a review from meganrogge August 3, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fancy animated button cannot be stopped by keyboard alone

2 participants