Skip to content

fix(cli): dismiss '?' shortcuts help on hotkeys and active states - #18583

Merged
LyalinDotCom merged 12 commits into
mainfrom
fix-shortcuts-menu-visibility-18546
Feb 12, 2026
Merged

fix(cli): dismiss '?' shortcuts help on hotkeys and active states#18583
LyalinDotCom merged 12 commits into
mainfrom
fix-shortcuts-menu-visibility-18546

Conversation

@LyalinDotCom

Copy link
Copy Markdown
Collaborator

Summary

Improve ? Quick Shortcuts Help visibility so it dismisses during active workflows and on registered hotkeys.

Details

  • Added a shared shortcuts-help hotkey dismissal matcher in packages/cli/src/ui/utils/shortcutsHelp.ts.
  • Dismiss shortcuts help from both input-level and global key handlers when registered app hotkeys are pressed.
  • Enforced passive-state visibility for shortcuts help:
    • hide while agent is streaming/running
    • hide when action-required confirmation/dialog states are present
  • Kept existing ? behavior, Esc precedence, and existing input semantics intact.
  • Updated keyboard shortcut docs to match runtime behavior.
  • Added focused coverage in InputPrompt, Composer, and AppContainer tests.

Related Issues

Fixes #18546
Related to #18532

How to Validate

  1. Run focused tests:
    • npm run test --workspace @google/gemini-cli -- src/ui/components/InputPrompt.test.tsx src/ui/components/Composer.test.tsx src/ui/AppContainer.test.tsx
  2. Run static/build checks:
    • npm run lint --workspace @google/gemini-cli
    • npm run typecheck --workspace @google/gemini-cli
    • npm run build --workspace @google/gemini-cli
  3. Manual behavior checks:
    • Open shortcuts help with ? on empty prompt.
    • Press registered hotkeys (for example Ctrl+R, Ctrl+X, F12) and verify shortcuts help closes.
    • Start a streaming/agent action and verify shortcuts help auto-hides.
    • Trigger action-required confirmation/dialog state and verify shortcuts help is hidden.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@LyalinDotCom
LyalinDotCom requested review from a team as code owners February 9, 2026 00:03
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @LyalinDotCom, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the user experience of the CLI's shortcuts help panel. Previously, the panel could remain visible during active operations or when other critical UI elements required attention. The changes ensure that the shortcuts help automatically dismisses when a user presses a registered hotkey or when the application transitions into an active state like streaming responses or displaying confirmation dialogs. This makes the help panel less intrusive and more context-aware, improving overall usability without altering its core activation or manual dismissal methods.

Highlights

  • Improved Shortcuts Help Dismissal: The '?' Quick Shortcuts Help now automatically dismisses when registered hotkeys are pressed, or when the application enters an active workflow state (e.g., agent streaming, action-required confirmations).
  • Enhanced User Experience: Ensures the shortcuts help panel is less intrusive by only showing in passive states, preventing it from obscuring critical information or interfering with active user input.
  • New Utility for Hotkey Matching: Introduced a shared utility function (shouldDismissShortcutsHelpOnHotkey) to centralize the logic for determining when a hotkey press should dismiss the shortcuts help.
  • Updated Documentation: The keyboard-shortcuts.md file has been updated to reflect the new dismissal behaviors for the shortcuts panel.
  • Comprehensive Test Coverage: Added new focused tests in AppContainer, Composer, and InputPrompt to validate the correct dismissal behavior under various conditions.
Changelog
  • docs/cli/keyboard-shortcuts.md
    • Updated the description for the '?' shortcut to include dismissal by registered app hotkeys, streaming, and action-required dialogs.
  • packages/cli/src/ui/AppContainer.test.tsx
    • Added a new test suite 'Shortcuts Help Visibility' to verify dismissal when a registered hotkey is pressed, when streaming starts, and when an action-required confirmation appears.
  • packages/cli/src/ui/AppContainer.tsx
    • Imported shouldDismissShortcutsHelpOnHotkey utility.
    • Implemented logic within the global keypress handler to dismiss shortcuts help if a registered hotkey is pressed.
    • Introduced hasPendingActionRequired and isPassiveShortcutsHelpState derived states to control shortcuts help visibility based on application activity.
    • Added a useEffect hook to automatically dismiss shortcuts help if the application is no longer in a passive state.
  • packages/cli/src/ui/components/Composer.test.tsx
    • Added tests to confirm shortcuts help is shown in a passive state but hidden during streaming or when an action is required.
  • packages/cli/src/ui/components/Composer.tsx
    • Modified the showShortcutsHelp variable to conditionally render the ShortcutsHelp component based on shortcutsHelpVisible, streamingState, and hasPendingActionRequired.
  • packages/cli/src/ui/components/InputPrompt.test.tsx
    • Expanded existing tests to include specific hotkeys (Ctrl+R, Ctrl+X, F12) as triggers for dismissing the shortcuts help.
  • packages/cli/src/ui/components/InputPrompt.tsx
    • Imported shouldDismissShortcutsHelpOnHotkey utility.
    • Integrated logic into the input-level key handler to dismiss shortcuts help if a registered hotkey is pressed.
  • packages/cli/src/ui/utils/shortcutsHelp.ts
    • New file created to define SHORTCUTS_HELP_DISMISS_HOTKEYS (a list of Command enums) and export shouldDismissShortcutsHelpOnHotkey function to check if a given Key matches any of these dismissal hotkeys.
Activity
  • The author has provided a detailed summary of the changes, outlining the problem and the solution.
  • Specific implementation details and their rationale are clearly documented.
  • Comprehensive validation steps, including focused tests, static/build checks, and manual behavior checks, have been provided.
  • A pre-merge checklist indicates thorough preparation, with documentation and tests updated, and validation performed on MacOS.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively improves the user experience by ensuring the shortcuts help panel is dismissed during active workflows and when hotkeys are pressed. The changes are well-structured, with new logic encapsulated in a dedicated utility function and new behavior covered by tests. The identified instance of duplicated logic for determining the hasPendingActionRequired state should be refactored to maintain a single source of truth.

Comment thread packages/cli/src/ui/AppContainer.tsx
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

Size Change: +2.03 kB (+0.01%)

Total Size: 24.3 MB

Filename Size Change
./bundle/gemini.js 24.3 MB +2.03 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Feb 9, 2026

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Pushed code review comments as a commit to this branch.

@LyalinDotCom
LyalinDotCom added this pull request to the merge queue Feb 12, 2026
Merged via the queue into main with commit f603f4a Feb 12, 2026
26 of 27 checks passed
@LyalinDotCom
LyalinDotCom deleted the fix-shortcuts-menu-visibility-18546 branch February 12, 2026 16:48

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

kuishou68 pushed a commit to iOfficeAI/gemini-cli-pro that referenced this pull request Feb 27, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
cocosheng-g pushed a commit that referenced this pull request May 6, 2026
@sripasg sripasg added the size/l A large sized PR label Jun 2, 2026
software-0ficial pushed a commit to software-0ficial/gemini-cli that referenced this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality size/l A large sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance '?' shortcuts menu visibility logic: Dismiss on hotkeys and agent activity

4 participants