Repository navigation
Keep nested dropdown menus on screen - #7168
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces responsive adjustments for dropdown submenus on mobile screens by utilizing the useIsMobile hook to conditionally apply a negative offset (-248) to several DropdownMenuSubContent components across thread.tsx, bypass-permissions-menu-item.tsx, and shared-composer.tsx. The review feedback suggests adding comments to explain the relationship between this magic number offset and the parent menu's width to improve maintainability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| side = "bottom", | ||
| }) => { | ||
| const navigate = useNavigate(); | ||
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; |
There was a problem hiding this comment.
The offset -248 is a magic number that depends on the parent menu's width (w-[244px]). Adding a comment explaining this relationship improves maintainability and helps future developers if the parent menu width is ever adjusted.
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; | |
| // Offset to shift submenus back over the parent menu (w-[244px]) on mobile/compact screens | |
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; |
| model2ThreadId?: string; | ||
| }): ReactElement { | ||
| const navigate = useNavigate(); | ||
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; |
There was a problem hiding this comment.
The offset -248 is a magic number that depends on the parent menu's width (w-[244px]). Adding a comment explaining this relationship improves maintainability and helps future developers if the parent menu width is ever adjusted.
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; | |
| // Offset to shift submenus back over the parent menu (w-[244px]) on mobile/compact screens | |
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; |
| // driven by the store), so it survives the menu unmounting and the "+"/More | ||
| // popovers don't stay frozen. | ||
| export function BypassPermissionsMenuItem() { | ||
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; |
There was a problem hiding this comment.
The offset -248 is a magic number that depends on the parent menu's width (w-[244px]). Adding a comment explaining this relationship improves maintainability and helps future developers if the parent menu width is ever adjusted.
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; | |
| // Offset to shift submenus back over the parent menu (w-[244px]) on mobile/compact screens | |
| const compactSubmenuOffset = useIsMobile() ? -248 : undefined; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed66c15a45
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!element) return; | ||
|
|
||
| const updateContentWidth = () => { | ||
| setContentWidth(element.getBoundingClientRect().width); |
There was a problem hiding this comment.
Use untransformed submenu width for compact offset
On mobile, this measures getBoundingClientRect().width while the submenu is opening with the data-open:zoom-in-95 transform applied below, so the stored width is about 95% of the menu's final visual width. ResizeObserver does not fire for transform-only animation changes, so when a submenu opens flush against the right edge the final menu can grow past the viewport by the missing ~5% even though sideOffset was intended to overlap by the full rendered width; measuring layout width (for example offsetWidth) or remeasuring after the animation avoids the residual overflow.
Useful? React with 👍 / 👎.
Summary
Root cause
Parent menus are commonly 176 to 244 pixels wide and nested menus are 208 to 300 pixels wide. On narrow screens, neither side has enough space for a full cascade. Collision handling selected the side with less overflow, but part of the nested menu could remain outside the viewport.
The initial compact workaround used one fixed offset for menus of several widths. That assumption could over-shift narrower menus and did not adapt when a submenu was resized or capped by the viewport. Measuring transformed bounds during the opening animation could also understate the final width.
Impact
Nested actions remain visible and clickable on compact screens across the chat UI. Each submenu now overlaps by its own rendered width, including collision-disabled menus and right-to-left layouts. Desktop behavior is unchanged because the shared primitive passes through every existing desktop
sideOffset.Validation
DropdownMenuSubContentconsumer in the frontend.uvenvironments.npm run typecheck.npm run build.npm run i18n:check.git diff --check.Notes
The failing Backend CI Python jobs reproduce on current
mainand are unrelated to this frontend change. PR #7169 fixes the incomplete DeepSeek reasoning test shim that causes those failures.