fix(cli): stabilize prompt layout to prevent jumping when typing#21081
fix(cli): stabilize prompt layout to prevent jumping when typing#21081NTaylorMullen merged 2 commits intomainfrom
Conversation
- Added minHeight and spacer text to shortcuts hint container - Ensures the line occupied by the hint remains in the layout even when the hint is hidden during typing - Updated tests and snapshots
Summary of ChangesHello, 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 resolves a minor UI annoyance in the CLI's prompt box where typing would cause the entire interface to jump vertically. The changes ensure that the area designated for the shortcut hint consistently occupies space, whether the hint is visible or not, thereby providing a stable and predictable user experience during text input. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the UI jumping issue by ensuring that the space for the shortcut hint is always reserved. The changes in Composer.tsx correctly implement this logic using minHeight and conditional rendering of <Text> </Text>. However, a crucial test case for the restoration of the shortcuts hint after debounce when the buffer is empty appears to have been removed, creating a gap in test coverage that could lead to regressions in this crucial UI behavior.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/cli/src/ui/components/Composer.test.tsx (823-832)
The test case restores shortcuts hint after 200ms debounce when buffer is empty was removed. This test specifically covered the scenario where the shortcuts hint reappears after the debounce period when the input buffer becomes empty. While the new tests cover the hiding of the hint, there isn't an explicit test that verifies its restoration after the buffer transitions from non-empty back to empty. This leaves a gap in test coverage for a crucial UI behavior, potentially allowing regressions where the hint might not reappear correctly.
|
Size Change: -1.3 kB (0%) Total Size: 26.4 MB
ℹ️ View Unchanged
|
jacob314
left a comment
There was a problem hiding this comment.
Would be good to polish before landing aligned with these comments from /review-frontend that are a little harsh but generally reasonable.
|
This is a review from Overall, the intention of this PR is good—preventing the UI from jumping when the user starts typing is a great improvement. However, there are a few issues with the current implementation that affect both the layout logic and the "minimal" UI mode. 1. Minimal Mode Blank Line & Snapshot RegressionThe current approach introduces a permanent blank line above the prompt in minimal mode (which is clearly visible in the updated When {showUiDetails && showShortcutsHint ? (
<ShortcutsHint />
) : (
<Text> </Text>
)}will evaluate to 2. Still Jumps in Minimal ModeThe PR attempts to add the same Since the whole row unmounts when the user starts typing, the UI still jumps by one line in minimal mode. The 3. Cleaner Solution:
|
- Use minHeight on shortcut hint containers to reserve space without unintended blank lines - Fix jumping in minimal mode by ensuring the meta row stays mounted when space is reserved - Restore missing test case for shortcut hint restoration - Update snapshots to reflect corrected layout

Summary
This PR fixes a minor UI annoyance where typing in the prompt box would cause the entire UI to jump vertically.
Details
Previously, the shortcut hint (
? for shortcuts) was removed from the DOM when the prompt buffer was not empty. This caused the layout to shift up by one line.Changes:
minHeight={1}to the shortcut hint container inComposer.tsx.<Text> </Text>) when the hint is hidden while typing.Related Issues
None.
How to Validate
npm run build && npm start? for shortcutshint in the bottom right.Pre-Merge Checklist