Repository navigation
fix(site): keep floating content within the viewport at 320px - #31348
jeremyruppel merged 6 commits into
Conversation
Menus, popovers, selects, and tooltips clipped their content when the viewport was 320px wide (1280px at 400% zoom), failing WCAG 1.4.10 Reflow. Cap each primitive to the Radix-provided available width and height and scroll vertically instead of hiding overflow. Callers that set their own max-width now take the smaller of that width and the available space, and the full-width mobile menu opts out of the width cap. Fixes DEQ-588, DEQ-492, DEQ-339, DEQ-346, DEQ-168, DEQ-6.
|
@chrifro this PR now conflicts with 🤖 Generated by Coder Agents on behalf of @bartekgatzcoder. |
…-or-functionality-is-unavailable-at-320px-width # Conflicts: # site/src/components/DropdownMenu/menuClasses.ts # site/src/components/Popover/Popover.tsx # site/src/components/Select/Select.stories.tsx # site/src/components/Tooltip/Tooltip.tsx # site/src/modules/users/UserGroupsCell.tsx # site/src/pages/AIBridgePage/SessionThreadsPage/SessionTimeline/SessionTimeline.tsx # site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx
…-or-functionality-is-unavailable-at-320px-width
…-or-functionality-is-unavailable-at-320px-width # Conflicts: # site/src/components/DropdownMenu/menuClasses.ts # site/src/components/Select/Select.tsx # site/src/components/Tooltip/Tooltip.tsx # site/src/modules/dashboard/Navbar/MobileMenu.tsx
At a 320px-wide viewport (1280px at 400% zoom), workspace sharing lost functionality, failing WCAG 1.4.10 Reflow. The Share popover was a fixed 580px wide, and in both the popover and the sharing settings page, the add row (member search, role select, **Add member**) and the members table's Role and menu columns fell off screen. This follows the pattern `ChatSharingPopover` already uses for the same layout: - Share popover: `w-[calc(100vw-2rem)] p-3 sm:w-145 sm:p-4`. - Add form: stacks below `sm` with a full-width search, role select, and button. The `UserOrGroupAutocomplete` default width becomes `w-full sm:w-80`. - Table: member names stay on one line (`whitespace-nowrap`), and the table scrolls horizontally inside its own container when it is wider than the popover or page. The Role and menu cells use `max-sm:px-1`. - Phone-width stories for the popover and the settings page include a long username. Desktop layout is unchanged. Fixes [DEQ-539](https://linear.app/codercom/issue/DEQ-539). ## Before / after (320px wide, Storybook) "Before" is the first revision of this PR, which wrapped names character by character to fit the column. | | Before (names wrap) | After (table scrolls) | After, scrolled right | |---|---|---|---| | Share popover |  |  |  | | Sharing settings page |  |  |  | These are Playwright measurements at 320×640. | | Before | After | |---|---|---| | Page width (document scroll width) | 305px, no page scroll | 305px, no page scroll | | Members table (scroll / visible width) | 262/262px, names wrapped to up to 20 lines | 579/262px, scrolls inside the table container | | Long username line height | 480px | 24px (one line) | | 1280px desktop | | unchanged | Only the table scrolls, not the page, which 1.4.10 permits for data tables. Also checked on a real workspace page in a local dev deployment at 320px: 525/262px table scroll, no page overflow. <details> <summary>Implementation plan and decision log</summary> **Context.** This is the second of three PRs for the Deque 1.4.10 Reflow issues. PR #31348 fixes the shared floating primitives (menus, popover, select, tooltip). This PR covers the page-specific sharing layout (DEQ-539), and DEQ-443 (notifications inbox) follows. **Decisions** - Reused `ChatSharingPopover`'s responsive classes instead of a new pattern, for consistency and reviewability. - The first revision wrapped member names with `wrap-anywhere`, which split names like `TestUser` across several lines at 320px. Review feedback asked for scrolling instead, so names are `whitespace-nowrap`, the role select keeps its fixed `w-40`, and the `Table` wrapper's existing `overflow-auto` scrolls the table on both axes. In the compact view, `max-h-60` caps the height. - `max-sm:px-1` on the Role and menu columns keeps the scroll distance short at 320px, and desktop padding is unchanged. - Merged `main`, which in the meantime landed the single compact table with a sticky `<thead>` (#31941), the exported `workspaceACLKey`, and fuller `ShareButton` stories. This PR now only adds the responsive classes and a `NarrowViewport` story on top of those. - Kept a table instead of `ChatSharingPopover`'s separate mobile card list, which would duplicate the rows and role select controls. **Verification** - Playwright at 320×640 and 1280×800 against the new stories, and at 320px against a real workspace in a local `./scripts/develop.sh` deployment. - `pnpm check`, `pnpm lint`, and `pnpm format` pass. The `ShareButton` and `WorkspaceSharingPageView` story tests pass (16/16). </details> --- 🤖 Generated by Coder Agents on behalf of @chrifro. --------- Co-authored-by: Jeremy Ruppel <[email protected]> Co-authored-by: Jeremy Ruppel <[email protected]>
aqandrew
left a comment
There was a problem hiding this comment.
Having some trouble running locally, but the code+screenshots look sound. Thanks for this!
Interactive tooltips with max-w-xs overflowed by their collision padding, and menu min-w-48 overrode the new max-w on submenus.
…-or-functionality-is-unavailable-at-320px-width # Conflicts: # site/src/components/DropdownMenu/DropdownMenu.stories.tsx # site/src/components/DropdownMenu/menuClasses.ts
jeremyruppel
left a comment
There was a problem hiding this comment.
Reviewed at 7a31d22. Shared floating primitives (menus, popover, select, tooltip) now stay within a 320px viewport; verified the DEQ-6, DEQ-339, DEQ-346, DEQ-492, and DEQ-588 surfaces at 320x256 in Storybook. Review fixes (InfoTooltip/AgentStatus width caps, submenu min-w cap) were pushed in 12ee6a6. Nit, not addressed: tooltips have no height cap, so tall ones can overflow a 256px-tall viewport.
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
At a 320px-wide viewport (1280px at 400% zoom), shared floating UI clipped its content, failing WCAG 1.4.10 Reflow. Menus had
overflow-hiddenand no height limit, Select had a fixedmax-h-96, and Popover and Tooltip had no width limit, so items and text ended up past the viewport edge where neither scrolling nor the keyboard could reach them.Each primitive is now capped to the available space that Radix reports (
--radix-popper-available-*), and menus scroll instead of hiding overflow:DropdownMenu/ContextMenu(menuClasses.ts):max-wfrom the available width (the height cap and scrolling landed separately in fix(site/src/components): scroll menus that do not fit the viewport #32385).min-wismin(12rem, available width)so it can't override the cap on submenus.Popover:max-wfrom the available width, so fixed widths such as the ports popover'sw-[404px]shrink to fit.Select:max-his nowmin(24rem, available height), plusmax-wfrom the available width.Tooltip:max-wfrom the available width, pluswrap-break-word.tailwind-merge drops the base cap when a caller passes its own
max-w, so callers wider than 320px now usemax-w-[min(<size>,var(--radix-popper-available-width))](SessionTimeline, IdpUnseenClaimWarning, AgentLogs, UserGroupsCell, workspace Notifications). Interactive tooltips add 8px collision padding, soInfoTooltipandAgentStatus(max-w-xs) use the same form.MobileMenuis full width by design, so it opts out of the width cap withmax-w-none. NewNarrowViewportstories for the four primitives run on Pixel'sphoneviewport. Each story overflows without the fix.Closes DEQ-588, DEQ-492, DEQ-339, DEQ-346, DEQ-6
Refs DEQ-168 (Login type select only)
Before / after (320×256 CSS viewport)
Playwright measurements of the same scenarios (the surface's bottom or right edge against the 256px-tall, 320px-wide viewport):
Not covered here: DEQ-125 (the toast already fits at 320px, and the report points at the dialog overlay, so it needs a licensed repro), the DEQ-168 organization picker (not reproduced), and the DEQ-539 sharing form and DEQ-443 notifications inbox, whose page layouts are planned as separate PRs.
Implementation plan and decision log
Grouping. Eight Deque 1.4.10 Reflow issues (DEQ-588, 539, 492, 443, 346, 339, 168, 125, 6) were grouped by root cause. Most trace to five shared floating primitives (menus, tooltip, select, popover, toast), so fixing those once resolves most issues. DEQ-539 (sharing form row and table) and DEQ-443 (inbox header and rows) are page layout problems and get separate PRs.
Approach. Cap every primitive to the Radix available-space CSS variables, let text wrap, and scroll rather than clip.
Decisions
--radix-popper-available-*, which the popper wrapper sets and content inherits, so one variable works for menu, popover, and tooltip.min(24rem, var(--radix-select-content-available-height, 24rem)), soitem-alignedmode, where the variable is unset, still behaves as before.collisionPaddingstays at Radix's default of 0. About 25 tooltip callers passmax-w-xs(320px), which tailwind-merge keeps over the base cap. With padding 0 they still fit a 320px viewport, but an 8px padding would have pushed them over.max-wwider than 320px got themin(...)form instead of a wholesale codemod.MobileMenuusesmax-w-none. The new cap left a 15px gap on this full-width menu.max-w-fullchange: sonner already switches to full width below 600px, so the toast fit before and after.Verification
./scripts/develop.sh), plus Storybook for license-gated or workspace-gated surfaces. The before runs had the changes stashed.tscpass, andmake pre-commitpasses.WorkspacePage.test.tsxfails the same way without these changes.Review follow-up (@jeremyruppel)
InfoTooltip(with-link story) measured right edge 356px at 320px before, 297px after.min-w-48beat the newmax-won submenus, where available width is only the space beside the sub-trigger.*-100callers kept as25remrather than400pxso they still scale with root font size.🤖 Generated by Coder Agents on behalf of @chrifro, with review fixes on behalf of @jeremyruppel.