Repository navigation
Responsive grid layout: fixed TopBar/Sidebar with document scroll - #3178
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
90eb34e to
d22f1fe
Compare
Switch from a CSS grid layout (where TopBar and Sidebar occupied grid cells alongside ContentPane) to fixed-position TopBar and Sidebar with document-level scroll. This is the foundation for mobile/tablet support. Key changes: - viewport meta tag: proper responsive instead of fixed 1050px - CSS: add --sidebar-width var, responsive --content-gutter, remove body overflow-y-hidden, set html/body/#root height: 100% - TopBar: single fixed element (was two grid cell fragments) - Sidebar: fixed position with overflow scroll - ContentPane: margin-left for sidebar on desktop, document scroll - Scroll restoration: window.scrollY instead of container scrollTop - PageSkeleton: match new fixed layout structure Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
85918cc to
ecf1870
Compare
| * different points in the history stack will not share the same scroll position. | ||
| */ | ||
| export function useScrollRestoration(container: React.RefObject<HTMLElement | null>) { | ||
| export function useScrollRestoration() { |
There was a problem hiding this comment.
Do we even need this hook now? Since we're using a regular window scroll, perhaps we can use the built-in react-router one.
There was a problem hiding this comment.
Similar to #2450 if I remove it I was unable to get react-router ScrollRestoration to work
| import { classed } from '~/util/classed' | ||
|
|
||
| export const PageContainer = classed.div`grid h-screen grid-cols-[14.25rem_1fr] grid-rows-[var(--top-bar-height)_1fr]` | ||
| export const PageContainer = classed.div`min-h-full pt-(--top-bar-height)` |
There was a problem hiding this comment.
Top bar is fixed, this leaves space for it. Alternatively we use sticky for the top bar but the sidebar would still be fixed and this feels marginally cleaner.
|
PR is visually identical to main with expanded visual regression tests. Haven't figured out an easy way to test it scrolled since the baseline would require a different scroll pattern to this new PR. I'd suggest we err on merging sooner so it can be tested for longer. |
|
4d4e03f fixes the side modal scroll bar thing by turning on In base-ui, this covers it and the Lines 54 to 61 in f25398d
In order to make this work I also added a scrim for the modal on top of a side modal situation with a special z-index that makes sure it's between the modal and the side modal and blocks interaction with the side modal. Right now on main you can interact with the image upload side modal while the main upload modal is going. |
|
I have fixes for the e2e failures but I want to merge #3192 into main and main into this first because it affects at least one of them. |
Found this while working on #3178. Instance resize, attach floating IP, and attach ephemeral IP all had `onError`s that triggered toasts on server error. The first two also displayed the error in the modal. Ephemeral IP did not. This PR gets rid of the toasts and puts an error display into attach ephemeral IP. It doesn't look very good (maybe we should move the error and give it a little box or something), but it's basically the same as it already was, minus the extra toasts. (Screenshot is from playwright, hence the weird missing submit button — I think it's right in the middle of switching between the button text and the loading spinner.) <img width="930" height="528" alt="Screenshot 2026-04-21 at 5 20 23 PM" src="https://github.com/user-attachments/assets/0c6db6a6-913f-40aa-8ccc-245be9dfc1d0" />
ecbc9e6 to
9881dd5
Compare
Test failure in #3195 repros locally no problem: <img width="747" height="409" alt="image" src="https://github.com/user-attachments/assets/d1fed181-f26c-455b-a0ab-c8f8e962c1ae" /> Claude's speculation on why it suddenly became a problem after #3178 is good enough for me. This is the second or third time lately we've run into small issues because we're not awaiting `queryClient.invalidateEndpoint` in the mutation handlers. Something to keep an eye on. > The race: `NetworkingTab` gates the Delete row action on `nic.primary && multipleNics`, where `multipleNics = nics.length > 1`. When the `my-nic` delete mutation succeeds, `onSuccess` synchronously calls `queryClient.invalidateEndpoint` (not awaited) and closes the confirm modal. If the test opens nic-3's row-actions menu before the refetch lands, `nics.length` is still 2, so Delete renders disabled and wrapped in a `<Wrap with={<Tooltip/>}>`. When the refetch then lands mid-click, the `<Wrap>` unwraps, the `Menu.Item` remounts (old DOM detached), and on Safari/Firefox base-ui's Menu treats that focus/DOM churn as a close — so Playwright's retry never resolves a clickable Delete and hits the 60s timeout. > > When it was introduced: the disable rule landed April 2025 in #2806 ("Disable primary NIC delete when multiple NICs present"). The `DropdownMenu.Item` `<Wrap>`-with-Tooltip pattern has been in place since ~March 2025. So the race has been latent for about a year. > > Why it's surfacing now: first CI appearance was on the #3178 "Responsive grid layout" PR (2026-04-21), which landed on trunk 2026-04-22; every workflow run after that hits it. #3178 moved TopBar/Sidebar from CSS-grid cells to fixed-position elements, switched to document-level scroll, removed `overflow-y-hidden` on body, and set `height: 100%` on html/body/#root. None of that touches the NIC flow, but it changed paint/layout timing around modal open/close and table reflow. That shifted the window such that `expect(my-nic cell).toBeHidden()` now reliably resolves while the page is briefly inert during the modal's close transition — before the refetch has actually landed — so the test races into opening nic-3's menu in the stale state. The layout PR didn't introduce the bug; it just removed the timing cushion that had been hiding it.
### Most interesting bits * [f9366d37](oxidecomputer/console@f9366d37) oxidecomputer/console#3212 * [621c61b9](oxidecomputer/console@621c61b9) oxidecomputer/console#3216 * [0abdd33e](oxidecomputer/console@0abdd33e) oxidecomputer/console#3226 * [1b2161a9](oxidecomputer/console@1b2161a9) oxidecomputer/console#3221 ### Full list oxidecomputer/console@a3b4757...0c8fd96 * [0c8fd96e](oxidecomputer/console@0c8fd96e) oxidecomputer/console#3236 * [f9366d37](oxidecomputer/console@f9366d37) oxidecomputer/console#3212 * [621c61b9](oxidecomputer/console@621c61b9) oxidecomputer/console#3216 * [0abdd33e](oxidecomputer/console@0abdd33e) oxidecomputer/console#3226 * [aea69234](oxidecomputer/console@aea69234) oxidecomputer/console#3232 * [1b2161a9](oxidecomputer/console@1b2161a9) oxidecomputer/console#3221 * [c95be72c](oxidecomputer/console@c95be72c) oxidecomputer/console#3230 * [576ce52a](oxidecomputer/console@576ce52a) oxidecomputer/console#3228 * [337b4e83](oxidecomputer/console@337b4e83) oxidecomputer/console#3227 * [aa608203](oxidecomputer/console@aa608203) oxidecomputer/console#3224 * [099d4633](oxidecomputer/console@099d4633) oxidecomputer/console#3210 * [8013fcbc](oxidecomputer/console@8013fcbc) oxidecomputer/console#3205 * [72996fed](oxidecomputer/console@72996fed) oxidecomputer/console#3208 * [acf669ba](oxidecomputer/console@acf669ba) oxidecomputer/console#3206 * [1761f9e8](oxidecomputer/console@1761f9e8) oxidecomputer/console#3204 * [5a65a9f8](oxidecomputer/console@5a65a9f8) oxidecomputer/console#3203 * [1dfbde82](oxidecomputer/console@1dfbde82) oxidecomputer/console#3188 * [93ae4397](oxidecomputer/console@93ae4397) oxidecomputer/console#3200 * [d169f5b0](oxidecomputer/console@d169f5b0) oxidecomputer/console#3199 * [145f0735](oxidecomputer/console@145f0735) oxidecomputer/console#3174 * [a2773c47](oxidecomputer/console@a2773c47) oxidecomputer/console#3198 * [4a9be313](oxidecomputer/console@4a9be313) oxidecomputer/console#3196 * [93f206c2](oxidecomputer/console@93f206c2) oxidecomputer/console#3178 * [03ff84ea](oxidecomputer/console@03ff84ea) oxidecomputer/console#3194 * [59f225eb](oxidecomputer/console@59f225eb) oxidecomputer/console#3192 * [f25398dd](oxidecomputer/console@f25398dd) oxidecomputer/console#3186 * [0e1fef07](oxidecomputer/console@0e1fef07) oxidecomputer/console#3191 * [be0d7a26](oxidecomputer/console@be0d7a26) oxidecomputer/console#3189 * [376009c8](oxidecomputer/console@376009c8) oxidecomputer/console#3187 * [7bf337b0](oxidecomputer/console@7bf337b0) oxidecomputer/console#3181
I noticed the preview had its page titles slightly higher than local dev. Took me a while to notice the entire preview banner was missing. Looks like we broke it in #3178. Broken: https://console-c5j03m75a-oxidecomputer.vercel.app/ Fixed: https://console-git-fix-preview-banner-oxidecomputer.vercel.app First commit here is the best version of the fix with the current structure, second commit rearranges things to move the banner out of the main app layout, which is what we always wanted to do anyway, it was just tedious. The diff is better with whitespace changes hidden.
… toasts Since #3178 switched the viewport to width=device-width, small screens got the desktop layout crushed into phone width: the always-visible fixed sidebar left the content pane ~160px wide. This ports the highest-value pieces of the closed responsive layout PR (#2087) onto the current layout: - Below the 1000px breakpoint, hide the sidebar and show it as an overlay with a scrim, toggled by a menu button in the top bar. Unlike #2087, visibility is CSS-driven (translate classes scoped to max-1000) rather than measuring window width in JS; the store only tracks open/closed. The overlay closes on any navigation. - Top bar: home button cell collapses below 1000px, user menu shows only the icon below 600px. - Side modals go full width below 600px; modals and toasts cap their width to the viewport instead of overflowing it. - Tab lists scroll horizontally on small screens instead of overflowing the page. Desktop rendering is unchanged. Verified at 390px: no horizontal overflow on projects, instances, instance detail, VPC, settings, or system pages. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018fdQ4zKzMdoxiJLQkLWo6k
#3178 was meant to redo part of #2087 as a stepping stone to a proper mobile layout, but then we didn't follow up, which means the mobile layout actually got worse — it's really bad! This is an attempt at some quick fixes to make it tolerable without breaking anything for desktop users. As long as nothing on desktop sizes is affected, even if there are flaws it's hard for it to be worse than the status quo. I think it feels really good, and a thorough review by Fable 5.1 didn't turn up any regressions at desktop sizes. ## 🤖 Summary Makes the console usable below 1000px, which is the existing `1000:` breakpoint from the design system. Above that width the layout is unchanged apart from the items called out at the end. ### Navigation - **Sidebar becomes an overlay on small screens.** A hamburger toggle in the top bar opens it over the content with a scrim. It closes on scrim click and on any navigation, including navigations from breadcrumbs or quick actions. Open state lives in a small zustand store (`app/stores/mobile-nav.ts`) so the top bar and sidebar can share it. `PageSkeleton` renders the sidebar closed so there is no flash of an open drawer during load. - **Top bar collapses to a single cell.** The home button cell only exists at desktop width. The shared class strings in `app/layouts/helpers.tsx` are used by both `TopBar` and `PageSkeleton` so the two can't drift. - **Breadcrumbs collapse instead of overflowing.** When the path doesn't fit, leading crumbs are folded into a "…" menu listing the full path, keeping the silo picker and user menu in view. Widths are measured from an invisible copy of the crumbs so the longest complete suffix that fits can be chosen; the current crumb is the last to give way and truncates with an ellipsis as a final fallback. This applies at all widths, so long paths on desktop also collapse rather than pushing the right-side controls off screen. - **User menu shows the username inside the menu** on small screens, where it is hidden from the trigger to save space. ### Components - `Modal`, `SideModal`, `Toast`, and `ErrorPage` are capped to the viewport width with a gutter so they no longer run edge to edge or overflow. - Tab lists scroll horizontally below the breakpoint instead of overflowing the page. - `CardBlock.Header` actions, `DisksTableField` buttons, `Radio` cards, and `DateTimeRangePicker` stack or stretch to full width on small screens. - Serial console terminal uses the full width and hides the scroll buttons on small screens; the footer height becomes content-driven. - Side modal gutter shrinks to 1.5rem below the breakpoint. ### Changes that also affect desktop - `--content-gutter` shrinks below 1000px rather than 768px, so windows between 768 and 999px get the narrower gutter. This aligns the gutter with the layout breakpoint used everywhere else. - `overscroll-behavior-y: none` on `body` prevents pull-to-refresh and scroll chaining behind the sidebar overlay. On macOS this also removes the vertical rubber-band bounce. - `DropdownMenu.Content` defaults `collisionPadding` to 12px (Base UI default is 5px) so menus keep a consistent margin from the viewport edge. ### Tests - New `test/e2e/mobile-layout.e2e.ts` covers the sidebar overlay open/close/navigate flow, the breakpoint transition at 999/1000px, the username in the user menu, and modal/toast bounds at 320px. - `test/e2e/breadcrumbs.e2e.ts` adds cases for collapsed breadcrumbs at 404, 650, 750, and 1024px, including the full-path menu. - The serial console visual regression test is scoped to a role locator because `getByText` now also matches the hidden breadcrumb measurement copy.

Refactor of #2087
Switch from a CSS grid layout (where TopBar and Sidebar occupied grid cells alongside ContentPane) to fixed-position TopBar and Sidebar with document-level scrolling. This is the foundation for mobile/tablet support and likely the place that has the potential to cause the most issues so I'm separating the two.
This PR should produce a console that is visually identical to the current one.
Broader responsive changes will come in another PR, and are not a blocker for this.
Todo