Repository navigation
fix(site): keep workspace sharing usable at 320px - #31408
jeremyruppel merged 6 commits into
Conversation
At a 320px-wide viewport (1280px at 400% zoom), the Share popover was a fixed 580px, and the add member row and the members table's Role and menu columns ended up off screen, failing WCAG 1.4.10 Reflow. Follow ChatSharingPopover: size the popover to the viewport below sm, stack the add form, let the role select shrink and member names wrap, and render the compact view as one table with a sticky header so the header and rows scroll together. Fixes DEQ-539.
…-or-functionality-is-unavailable-at-320px-width # Conflicts: # site/src/modules/workspaces/WorkspaceSharingForm/UserOrGroupAutocomplete.tsx # site/src/modules/workspaces/WorkspaceSharingForm/WorkspaceSharingForm.tsx # site/src/pages/WorkspacePage/WorkspaceActions/ShareButton.stories.tsx # site/src/pages/WorkspacePage/WorkspaceActions/ShareButton.tsx
…available-at-320px-width
…available-at-320px-width
…when read-only Limit the member cell nowrap to small screens so long names wrap again in the 580px Share popover, and make the read-only table's scroll area focusable on the settings page too, where it now overflows at 320px. Share the long-name fixture and add a narrow read-only story. 🤖 Generated by Coder Agents on behalf of @jeremyruppel.
jeremyruppel
left a comment
There was a problem hiding this comment.
Approving. The 320px fix works: in Storybook at 320px the add row stacks within the viewport, the table scrolls inside its own container, Tab never puts focus off-screen, and axe finds nothing new.
I pushed d932211 on top to fix three things that came from the new whitespace-nowrap. Each is explained in an inline note. Biome, tsc and the ShareButton and WorkspaceSharingPageView story tests (17/17) pass locally.
Non-blocking nits I left alone:
- The
w-fullparts ofw-full sm:w-80,w-full sm:w-40andw-full sm:w-autodo nothing, sinceAutocompleteandSelectTriggerare already full width. Keeping them so the classes matchChatSharingPopoveris fine. - The description says the PR follows
ChatSharingPopover. That's true for the popover and the form, butChatSharingPopoverreplaces the table with a list on small screens, while this PR scrolls the table.
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
| {workspaceACL.group.map((group) => ( | ||
| <TableRow key={group.id}> | ||
| <TableCell className="py-2 w-[50%]"> | ||
| <TableCell className="py-2 w-[50%] max-sm:whitespace-nowrap"> |
There was a problem hiding this comment.
Changed whitespace-nowrap to max-sm:whitespace-nowrap here and at :319. Without the prefix, long names also stopped wrapping on desktop: in the 580px Share popover at 1280px, the long-name data made the table content 611px wide in a 546px container, so the ⋮ menu was hidden until you scrolled sideways. With the prefix it fits (546 of 546px), and the 320px behavior is unchanged.
| // Without row controls, keyboard users need the scroll area itself to be focusable. | ||
| wrapperProps={ | ||
| isCompact && !canShareWorkspace | ||
| !canShareWorkspace |
There was a problem hiding this comment.
Dropped isCompact &&. Now that names don't wrap, the read-only table on the settings page overflows at 320px when a name is long. Its rows have no controls, so keyboard users couldn't scroll it, and axe flagged scrollable-region-focusable in the new NarrowViewportReadOnly story. With this change the scroll area gets tabIndex=0 and role="region" and axe passes.
| role: "use", | ||
| }; | ||
|
|
||
| export const MockWorkspaceUserLongName: TypesGen.WorkspaceUser = { |
There was a problem hiding this comment.
Moved the long-name user both stories defined inline into a shared mock. The old username was 39 characters, over the 32-character limit (codersdk/name.go:45). This one is exactly 32, and it also has a long display name, because the subtitle wraps too.
| }, | ||
| }; | ||
|
|
||
| export const NarrowViewportReadOnly: Story = { |
There was a problem hiding this comment.
Added a narrow read-only story so Pixel and the story tests cover the case fixed at WorkspaceSharingForm.tsx:384.
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
ChatSharingPopoveralready uses for the same layout:w-[calc(100vw-2rem)] p-3 sm:w-145 sm:p-4.smwith a full-width search, role select, and button. TheUserOrGroupAutocompletedefault width becomesw-full sm:w-80.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 usemax-sm:px-1.Desktop layout is unchanged. Fixes 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.
These are Playwright measurements at 320×640.
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.
Implementation plan and decision log
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
ChatSharingPopover's responsive classes instead of a new pattern, for consistency and reviewability.wrap-anywhere, which split names likeTestUseracross several lines at 320px. Review feedback asked for scrolling instead, so names arewhitespace-nowrap, the role select keeps its fixedw-40, and theTablewrapper's existingoverflow-autoscrolls the table on both axes. In the compact view,max-h-60caps the height.max-sm:px-1on the Role and menu columns keeps the scroll distance short at 320px, and desktop padding is unchanged.main, which in the meantime landed the single compact table with a sticky<thead>(fix(site/src): render the compact workspace sharing list as one table #31941), the exportedworkspaceACLKey, and fullerShareButtonstories. This PR now only adds the responsive classes and aNarrowViewportstory on top of those.ChatSharingPopover's separate mobile card list, which would duplicate the rows and role select controls.Verification
./scripts/develop.shdeployment.pnpm check,pnpm lint, andpnpm formatpass. TheShareButtonandWorkspaceSharingPageViewstory tests pass (16/16).🤖 Generated by Coder Agents on behalf of @chrifro.