Summary
Typing / in a fresh commit draft opened the /feature and /bug menu inside the composer, so the composer's actions and the whole page under it jumped down 100px, and back up when it closed. The mention, emoji, issue and guild suggestions float over the page instead. This makes the command menu float the same way, so nothing moves when it opens.
The jump grows with the menu: every command added to it pushes the page down further. Several open PRs add some:
- #1669 lists
/shrugand/tableflipafter/featureand/bug; - #359 adds
/image(/img),/polland/code, and moves the commands into the field's own suggestion menu, which floats already: if it lands first, this one has nothing left to fix; - #367 adds
/gifonce a GIF provider key is set.
With a floating menu, a longer list only takes more room over the page, not in it.
Changes
- Floating menu.
IssueCommandSuggestionsrenders in a portal, fixed under the slash that starts the draft, with the same popover surface as the field's suggestions. It follows the page when it scrolls or resizes, and opens above the slash near the bottom of the viewport. - Shared placement. The code placing the field's suggestions moves from
MentionTextareatolib/suggestion-position.tsassuggestionPositionAt(), used by both.MentionTextareabehaves as before. - Composer dialog. The dialog already lets clicks through to
[data-command-suggestions], so the menu can go past the dialog's edge instead of making it grow. - Key hints. At the suggestions' width, the hints wrap between
↑↓ select,Tab or Enter pickandEsc dismissrather than inside one.
Validation
| Check | Result |
|---|---|
pest --parallel --coverage --exactly=100.0 (full suite) | 6516 passed, 100.0% |
pest --type-coverage --min=100 | 100.0% |
tsc --noEmit (app and tests) | clean |
vp test (TSX unit tests) | 110 files, 1113 passed |
node --test tests/Unit/*.test.ts | 333 passed |
vp fmt --check, vp lint | clean |
All local; hosted CI runs once a maintainer approves the workflow.
Visual evidence
Playwright (Chromium) against a local dev server with seeded data, signed in as the local developer, typing / in an empty draft. Before is production (0e09618a), after is this branch.
Layout shift, measured on the Log at 1440×900 from before typing to the menu being open:
| Before | After | |
|---|---|---|
| Commit button moves | 100px down | 0px |
| First commit below moves | 100px down | 0px |
Layout shift score (PerformanceObserver) | 0.024 | 0 |
| Before | After | |
|---|---|---|
| Log composer, 1440 light | ||
| Log composer, 1440 dark | ||
Composer dialog (c), 1440 light | ||
Dialog reopened on the restored / draft, 1440 light |
| Before, 390 light | After, 390 light |
|---|---|
Device verification
Emulation only (390×844, DPR 2, touch) in Chromium: no hardware or simulator. On a phone the menu floats under the slash like the mention suggestions do, over the actions instead of pushing them below the fold.
Independent review
A fresh read-only reviewer, given the guidelines, the diff, the validation results and the captures, checked the move of the placement code, server rendering, the first paint, the dialog's outside-click and Escape handling, the keys and the tests. On base 0e09618a, head 2828c49b: CODE: PASS, VISUAL: PASS. Applied in b85795ae, with tests:
- the menu measures again when an animation ends, so a dialog reopened on a restored
/draft doesn't leave it where the dialog was while zooming in (checked in the browser: it sits under the slash); - pressing on the menu's padding or hints keeps the focus in the field, as with the field's suggestions, instead of closing the menu;
- each
·starts the hint after it, so none is left at the end of a line.
Limitations
- Like the field's suggestions, the open menu covers the composer's toolbar under it; picking a command or pressing Esc uncovers it.
- The menu keeps the field's suggestions' 288px width, narrower than before, so its hints take two lines.
Summary by CodeRabbit
- Bug Fixes
- Issue-command and other suggestion menus now appear beside the relevant text entry point and adjust their position when the viewport changes.
- Menus wait until the text field is available before appearing, reducing misplaced suggestions.
No actionable comments were generated in the recent review.
Walkthrough
Textarea suggestion positioning now uses a shared character-position helper. Issue-command suggestions receive the composer’s textarea ref, recalculate their position on relevant viewport and animation events, and render in a fixed-position portal.
Changes: Suggestion positioning
resources/js/lib/suggestion-position.ts,resources/js/components/mention-textarea.tsxMentionTextareauses it to place and reposition suggestions.resources/js/components/issue-command.tsx,resources/js/components/commit-composer.tsx,tests/Unit/IssueCommandSuggestions.test.tsx,tests/Unit/ComposerDraft.test.tsxIssueCommandSuggestionsuses the textarea anchor to position a fixed menu in a portal. Tests cover anchor wiring, menu rendering, position updates, and listener cleanup.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)
Possibly related PRs
mention-textarea.tsx.Suggested reviewers:
nunomaduro,brendt,xheavenMerge Risk: Minimal · up to
b8579The change makes the slash-command menu float over the composer instead of pushing the layout down, and it shares the position calculation with the mention menu. No concrete defects were found, and the dialog's outside-click handling already treats the command menu as part of the dialog. Merge risk is minimal.
Pre-merge checks: 4
Full details: Title check
Explanation
The title names the main change: the slash-command menu (IssueCommandSuggestions) now floats over the composer through a viewport-fixed portal instead of pushing the composer and page down. The changeset adds the portal, the useSlashPosition recalculation, and the anchor prop, and the objectives confirm this is the primary purpose. The title is specific and short, and it fits the changeset.
Finishing Touches
Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
b650f3f9-908e-4f6c-8cb6-a08b8196bc7aReviewing files that changed from the base of the PR and between 0e09618a7765cf6f92a53b6ddb9a1a79e49c46b6 and b85795aeb39ee30f339746749af63dfd054aca60.
resources/js/components/commit-composer.tsxresources/js/components/issue-command.tsxresources/js/components/mention-textarea.tsxresources/js/lib/suggestion-position.tstests/Unit/ComposerDraft.test.tsxtests/Unit/IssueCommandSuggestions.test.tsxIncluded review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.