Skip to content

fix(dashboard): constrain dialog grid/flex children so long values stay inside on mobile#518

Merged
DorianZheng merged 1 commit into
mainfrom
fix/dialog-mobile-overflow
May 14, 2026
Merged

fix(dashboard): constrain dialog grid/flex children so long values stay inside on mobile#518
DorianZheng merged 1 commit into
mainfrom
fix/dialog-mobile-overflow

Conversation

@DorianZheng

Copy link
Copy Markdown
Member

Summary

PR #513 added CopyableValue (min-w-0 flex-1 overflow-x-auto on the value span) so long SSH commands / API keys would scroll inside the row instead of pushing siblings. The fix works in isolation but on narrow viewports the row itself still escapes its dialog — reproducer: Sandboxes → Create SSH Access on mobile, the ssh -p 2222 … command renders past the right edge of AlertDialogContent.

Root cause

AlertDialogContent is display: grid with no explicit grid-template-columns, so it gets a single implicit auto column whose items default to min-width: auto (= min-content). With whitespace-nowrap on the value span, that min-content is the full unbreakable SSH command — the grid item grows past max-w-[calc(100%-2rem)] and clips at the viewport. DialogContent has the same latent shape with flex flex-col items.

Fix

  • AlertDialogContent: add grid-cols-[minmax(0,1fr)] so the implicit auto column becomes minmax(0,1fr). Children can now shrink below content-width, and CopyableValue's internal overflow-x-auto engages.
  • DialogContent: add [&>*]:min-w-0 so every direct flex-col child gets min-width: 0 (Tailwind arbitrary child-selector).

One-line each. Fixes every CopyableValue site + any future long-content dialog without patching call sites.

Test plan

  • Open https://dev.boxlite.ai on a 375px-wide viewport (or DevTools device mode).
  • Sandboxes → … → Create SSH Access → verify the SSH command stays inside the dialog, scrolls horizontally within the row, copy button remains visible.
  • Create-Region / Create-Runner / Onboarding dialogs that show API keys: same check.
  • Existing desktop dialogs render unchanged (no regressions on sm:max-w-lg / sm:max-w-2xl widths).

…ay inside on mobile

PR #513 added CopyableValue (`min-w-0 flex-1 overflow-x-auto` on the value
span) so long SSH commands and API keys would scroll inside the row instead
of pushing siblings. The fix works in isolation but the row itself still
escapes its dialog on narrow viewports — reproducer is the Sandboxes "Create
SSH Access" dialog, where the ssh command renders past the right edge of
AlertDialogContent.

Root cause: `AlertDialogContent` uses `display: grid` with no explicit
`grid-template-columns`, so it gets a single implicit auto column whose
items default to `min-width: auto` (= min-content). With `whitespace-nowrap`
on the CopyableValue value span, that min-content is the full unbreakable
SSH command, so the grid item grows past `max-w-[calc(100%-2rem)]` and
visually clips at the viewport. `DialogContent` has the same shape with
`flex flex-col` items (which also default to `min-width: auto` on the cross
axis).

Fix:
- AlertDialogContent: add `grid-cols-[minmax(0,1fr)]` so the single column
  is `minmax(0,1fr)` instead of implicit auto. Items can now shrink below
  content width, and CopyableValue's internal `overflow-x-auto` engages.
- DialogContent: add `[&>*]:min-w-0` so every direct flex-col child gets
  `min-width: 0`. Same effect: children can shrink, content scrolls inside
  the row.

Fixes every existing CopyableValue + future long-content cases in one place
instead of patching every call site.
@DorianZheng DorianZheng merged commit f04b438 into main May 14, 2026
9 checks passed
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