Skip to content

fix(gemini): skip enter key interception for default preset#35

Merged
Manho merged 1 commit into
mainfrom
fix/gemini-enter-key-bug
Mar 5, 2026
Merged

fix(gemini): skip enter key interception for default preset#35
Manho merged 1 commit into
mainfrom
fix/gemini-enter-key-bug

Conversation

@Manho
Copy link
Copy Markdown
Owner

@Manho Manho commented Mar 5, 2026

Problem

When the Panelize extension is installed, pressing Enter on a standalone Gemini page does not send the message. Instead, it triggers the sidebar chat history menu (Share conversation / Pin / Rename / Delete).

Root Cause

enter-behavior-gemini.js intercepts Enter key events in the capture phase, calls preventDefault() + stopImmediatePropagation(), and then tries to find and click a send button via findSendButton(). The button finder uses broad CSS selectors like button[aria-label*="Send"], which can match wrong UI elements or fail to find the correct one.

The core issue: in default preset mode, the script re-implements Gemini's native behavior (Enter=send, Shift+Enter=newline) but does it worse.

Fix

Add an early return when enterKeyConfig.preset === 'default' to let Gemini's native Enter key handling work correctly without interception.

Testing

  • Verified Enter sends messages on standalone Gemini page
  • Verified Shift+Enter creates newlines
  • All existing tests pass (1 pre-existing failure in multi-panel-ime.test.js unrelated to this change)

The enter-behavior content script was intercepting Enter key events
in capture phase even when the default preset was active. Since the
default preset (Enter=send, Shift+Enter=newline) matches Gemini's
native behavior, intercepting it caused findSendButton() to match
wrong UI elements (e.g. sidebar menu buttons), breaking normal
message sending.

Add early return when preset is 'default' to let Gemini's native
Enter key handling work correctly.
@Manho Manho merged commit dc5c225 into main Mar 5, 2026
1 check passed
@Manho Manho deleted the fix/gemini-enter-key-bug branch March 5, 2026 01:59
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.

1 participant