Skip to content

fix: float the command menu over the composer instead of pushing it down - #1671

Open
jubianchi wants to merge 1 commit into
dev-null-sh:productionfrom
jubianchi:fix/command-menu-overlay
Open

jubianchi wants to merge 1 commit into
dev-null-sh:productionfrom
jubianchi:fix/command-menu-overlay

Conversation

@jubianchi

@jubianchi jubianchi commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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:

With a floating menu, a longer list only takes more room over the page, not in it.

Changes

  1. Floating menu. IssueCommandSuggestions renders 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.
  2. Shared placement. The code placing the field's suggestions moves from MentionTextarea to lib/suggestion-position.ts as suggestionPositionAt(), used by both. MentionTextarea behaves as before.
  3. 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.
  4. Key hints. At the suggestions' width, the hints wrap between ↑↓ select, Tab or Enter pick and Esc dismiss rather 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 (0e09618), 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 with / typed before: the menu sits in the composer and pushes its actions and the log down, desktop, light Log composer with / typed after: the menu floats under the slash and nothing moves, desktop, light
Log composer, 1440 dark Log composer with / typed before, desktop, dark Log composer with / typed after, desktop, dark
Composer dialog (c), 1440 light Composer dialog with / typed before: the dialog grows to hold the menu, desktop, light Composer dialog with / typed after: the menu floats past the dialog's edge and the dialog keeps its size, desktop, light
Dialog reopened on the restored / draft, 1440 light Composer dialog reopened on a restored / draft after: the menu sits under the slash, desktop, light
Before, 390 light After, 390 light
Log composer with / typed before, mobile, light Log composer with / typed after, mobile, 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.

Typing / in a fresh commit draft opened the /feature and /bug menu in the
composer's flow, so the actions under it and the rest of the page jumped
down, and back up when it closed. The mention, emoji, issue and guild
suggestions float over the page instead.

The menu now floats the same way: rendered in a portal, fixed under the
slash, moved along when the page scrolls or resizes, and opened above it
near the bottom of the viewport. In the composer dialog it can go past
the dialog's edge rather than being clipped by it. The code that places
the field's suggestions moves to lib/suggestion-position so both share
it, and the key hints wrap between hints at its narrower width.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

Layer / File(s) Summary
Shared textarea position calculation
resources/js/lib/suggestion-position.ts, resources/js/components/mention-textarea.tsx
The shared helper measures a textarea character and calculates its viewport-aware position. MentionTextarea uses it to place and reposition suggestions.
Anchored issue-command menu
resources/js/components/issue-command.tsx, resources/js/components/commit-composer.tsx, tests/Unit/IssueCommandSuggestions.test.tsx, tests/Unit/ComposerDraft.test.tsx
IssueCommandSuggestions uses 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)

sequenceDiagram
  participant CommitComposer
  participant IssueCommandSuggestions
  participant useSlashPosition
  participant suggestionPositionAt
  participant document.body
  CommitComposer->>IssueCommandSuggestions: Passes textareaRef as anchor
  IssueCommandSuggestions->>useSlashPosition: Requests anchor position
  useSlashPosition->>suggestionPositionAt: Measures anchor at index 0
  suggestionPositionAt-->>useSlashPosition: Returns viewport position
  useSlashPosition-->>IssueCommandSuggestions: Provides measured position
  IssueCommandSuggestions->>document.body: Portals fixed-position menu
Loading

Possibly related PRs

Suggested reviewers: nunomaduro, brendt, xheaven

Merge Risk: Minimal · up to b8579

The 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: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 change…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b650f3f9-908e-4f6c-8cb6-a08b8196bc7a
Commits

Reviewing files that changed from the base of the PR and between 0e09618 and b85795a.

Files selected for processing: 6

  • resources/js/components/commit-composer.tsx
  • resources/js/components/issue-command.tsx
  • resources/js/components/mention-textarea.tsx
  • resources/js/lib/suggestion-position.ts
  • tests/Unit/ComposerDraft.test.tsx
  • tests/Unit/IssueCommandSuggestions.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@jubianchi
jubianchi marked this pull request as ready for review November 22, 2026 23:30
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