Skip to content

fix(ui): persist expansion in AskUser dialog when navigating options#20559

Merged
jerop merged 1 commit intomainfrom
fix/persist-expansion-ask-user
Feb 27, 2026
Merged

fix(ui): persist expansion in AskUser dialog when navigating options#20559
jerop merged 1 commit intomainfrom
fix/persist-expansion-ask-user

Conversation

@jerop
Copy link
Copy Markdown
Contributor

@jerop jerop commented Feb 27, 2026

  • Lowered handleGlobalKeypress priority to Low in AppContainer. This ensures that focused interactive components (like AskUserDialog, BaseSelectionList, or text inputs) consume their keypresses first, preventing the global fallback logic from collapsing the expanded view during user interaction.
  • Added "Expansion Persistence" test suite to AppContainer.test.tsx to verify that the expanded view persists when keys are handled elsewhere and correctly toggles via Ctrl+O.

Fixes #18909

@jerop jerop requested a review from a team as a code owner February 27, 2026 13:55
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 addresses an issue where the UI's expanded state would inadvertently reset during user interaction with dialogs and lists. By strategically adjusting the priority of keypress handlers, interactive components can now correctly process navigation inputs, preserving their expanded views and improving the overall user experience without unexpected collapses.

Highlights

  • Keypress Priority Adjustment: The global expansion-reset keypress handler in AppContainer has been refactored and its priority lowered. This ensures that interactive components can handle keypresses before the global handler triggers an expansion reset.
  • Interactive Component Priority Elevation: Keypress handlers for AskUserDialog, BaseSelectionList, and SearchableList have had their priorities elevated. This allows them to process navigation-related keypresses (like arrow keys) and maintain their expanded state during user interaction.
  • Expansion Persistence Logic: The AppContainer now includes a dedicated high-priority keypress handler for explicit expansion/collapse actions, and a low-priority handler that only resets expansion if no other component has handled the keypress. This prevents unintended collapses when navigating within interactive elements.
  • New Test Coverage: New tests have been added to AppContainer.test.tsx to verify the correct behavior of expansion persistence, ensuring that expansion is maintained when a high-priority component handles a key and reset when no component does.
Changelog
  • packages/cli/src/ui/AppContainer.test.tsx
    • Added a new test suite 'Expansion Persistence' to verify that expansion is preserved when a high-priority component handles a key and reset when no component handles it.
  • packages/cli/src/ui/AppContainer.tsx
    • Removed the previous inline logic for handling expansion/collapse within the main handleGlobalKeypress function.
    • Introduced a new useKeypress hook with KeypressPriority.High to handle explicit expansion/collapse commands (SHOW_MORE_LINES).
    • Modified the original handleGlobalKeypress to be wrapped in a new useKeypress hook with KeypressPriority.Low, which now includes logic to reset expansion only if no other handler has processed the keypress.
  • packages/cli/src/ui/components/AskUserDialog.tsx
    • Set priority: true for the useKeypress hook handling review view navigation.
    • Set priority: true for the useKeypress hook handling dialog cancellation.
    • Set priority: true for the useKeypress hook handling general dialog navigation.
  • packages/cli/src/ui/components/shared/BaseSelectionList.test.tsx
    • Updated the renderBaseSelectionList helper to pass priority: true and focusKey: undefined to the BaseSelectionList component in tests.
  • packages/cli/src/ui/components/shared/BaseSelectionList.tsx
    • Changed the default value of the priority prop to true.
  • packages/cli/src/ui/components/shared/DescriptiveRadioButtonSelect.tsx
    • Added a new optional priority prop to the DescriptiveRadioButtonSelectProps interface.
    • Passed the priority prop from DescriptiveRadioButtonSelect down to the BaseSelectionList component.
  • packages/cli/src/ui/components/shared/SearchableList.tsx
    • Set priority: true for the useKeypress hook responsible for handling search input and navigation within the list.
Activity
  • No human activity has been recorded on this pull request yet.
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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 27, 2026

Size Change: +18 B (0%)

Total Size: 25.7 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.2 MB +18 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

Copy link
Copy Markdown
Contributor

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

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 introduces changes to the keypress handling logic within the AppContainer and related components to improve expansion persistence and prioritization. It ensures that keypresses handled by high-priority components, such as those in the AskUserDialog and BaseSelectionList, correctly maintain the expansion state of the application. Additionally, it resets the expansion state when a keypress is not handled by any component. The changes involve modifying the AppContainer component to use separate keypress handlers with different priorities for global keypresses and expansion toggling, and adding a priority prop to several components.

@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 27, 2026
@jackwotherspoon
Copy link
Copy Markdown
Collaborator

Tested and works for me 👏

Will let @jacob314 be the official reviewer

@jerop jerop force-pushed the fix/persist-expansion-ask-user branch 2 times, most recently from 01b197a to fecbda4 Compare February 27, 2026 15:50
@jerop jerop enabled auto-merge February 27, 2026 15:52
@jacob314 jacob314 self-requested a review February 27, 2026 16:04
@jerop jerop force-pushed the fix/persist-expansion-ask-user branch 2 times, most recently from e5e97ed to 4a1429b Compare February 27, 2026 17:30
- Lowered handleGlobalKeypress priority to Low in AppContainer. This ensures that focused interactive components (like AskUserDialog, BaseSelectionList, or text inputs) consume their keypresses first, preventing the global fallback logic from collapsing the expanded view during user interaction.
- Added "Expansion Persistence" test suite to AppContainer.test.tsx.
- Added a specific test case verifying that navigation (up/down arrow keys) correctly preserves expansion when handled by a high-priority component, while unhandled keys still trigger a collapse.
- Verified that Ctrl+O correctly toggles the expansion state.
- Confirmed that triggerExpandHint is correctly included in the handleGlobalKeypress dependency array to satisfy exhaustive-deps requirements.

Fixes #18909
@jerop jerop force-pushed the fix/persist-expansion-ask-user branch from 4a1429b to 35e8f86 Compare February 27, 2026 17:47
@jerop jerop added the release/patch-to-preview PR needs to be patch to preview release label Feb 27, 2026
@jerop jerop added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit 5d24d6a Feb 27, 2026
27 checks passed
@jerop jerop deleted the fix/persist-expansion-ask-user branch February 27, 2026 18:43
@jerop jerop removed the release/patch-to-preview PR needs to be patch to preview release label Mar 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 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI] Persist expansion in AskUser dialog when navigating options

3 participants