Skip to content

Mobile and tablet layouts - #2087

Closed
benjaminleonard wants to merge 22 commits into
mainfrom
responsiveness
Closed

benjaminleonard wants to merge 22 commits into
mainfrom
responsiveness

Conversation

@benjaminleonard

@benjaminleonard benjaminleonard commented Mar 21, 2024 •

Copy link
Copy Markdown
Contributor

Long overdue, but not as painful as I had expected. There are definitely refinements to be made to mobile layouts, but this is a good start. Feels a little magic to create an instance so easily and connect to it from your phone.

At some point we'll want to think about the actions that people are more likely to take on mobile devices and optimise for that. I'm thinking about dashboards, fault management, checking and increasing utilization – aka someone has pinged me about something and as an operator I need to check it out.

Some things are not disabled but unlikely to be usable on a mobile device. For example uploading an image – props to the first person to successfully upload a raw bootable image and boot from it.

@vercel

vercel Bot commented Mar 21, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Sep 16, 2024 8:15pm

@benjaminleonard

Copy link
Copy Markdown
Contributor Author

Priority for feedback on this PR will be ensuring we haven't regressed the desktop version.

<Button
variant="ghost"
size="sm"
className="md-:hidden"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be disabled universally I think. Users will not be using the CLI from their phones.

const closeModal = () => setIsOpen(false)

useEffect(() => {
document.body.classList.add('msw-banner')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps convoluted but only appears on the preview so not too concerned about it. We use it to add extra padding for the banner at the bottom. Banner has been moved to the bottom, mostly because it breaks less stuff in the navigation.

Comment thread app/components/Sidebar.tsx Outdated
{transitions(
({ x }, item) =>
item && (
<Dialog.Root

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels slightly weird to be using a dialog here but it means we can use the same sidebar across both layouts. If there's a place that needs a bit more of a discerning eye it's probably here and the state logic to make sure it's bulletproof.

Comment thread app/components/Sidebar.tsx Outdated
)
}

export const ProfileLinks = () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds profile info into the navigation, hidden on desktop because it's visible in the nav.

Comment thread app/components/Sidebar.tsx Outdated
)
}

const SignOut16Icon = () => (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move this into the design system

Comment thread app/components/TopBar.tsx Outdated
)
}

const Menu12Icon = ({ className }: { className: string }) => (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, will also add to the design system

Comment thread app/hooks/use-menu-state.ts Outdated

return useStore(
(store) => ({
isOpen: size.width >= 1024 ? true : store.isOpen,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to not like to target window sizes with javascript, but this felt like the easiest option. Forces the sidebar to be open on larger screen sizes since it's always visible.

Comment thread app/layouts/helpers.tsx Outdated
import { classed } from '~/util/classed'

export const PageContainer = classed.div`grid h-screen grid-cols-[14.25rem,1fr] grid-rows-[60px,1fr]`
export const PageContainer = classed.div`h-full pt-[var(--navigation-height)] [overscroll-behavior-y:none]`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched back to good old salt of the earth non-grid CSS. It was a great solution but we ran into some awkward browser behaviour where a forced scroll would mess up the layout irredeemably.

Comment thread app/ui/styles/index.css
:root {
--content-gutter: 2.5rem;
--sidebar-width: 14.25rem;
--navigation-height: 3.75rem;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do more of this stuff I think

Comment thread tailwind.config.js
'lg-': { max: '1279px' },
'md-': { max: '1023px' },
'sm-': { max: '767px' },
'sm+': { min: '640px' },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never used this - / + for responsive Tailwind before and I must say I am a fan, means we're not forced to class them mobile first.

Comment thread test/e2e/scroll-restore.e2e.ts Outdated

async function expectScrollTop(page: Page, expected: number) {
const container = page.getByTestId('scroll-container')
const container = page.locator('#content_pane')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was adding an ID to content pane already, so we no longer need the test-id

@david-crespo

Copy link
Copy Markdown
Collaborator

Obviously we need to test it properly, but I just tried it on my phone and it feels incredible.

@benjaminleonard

Copy link
Copy Markdown
Contributor Author

Refactoring the dialog out on desktop, its causing issues with side modals.

@david-crespo

Copy link
Copy Markdown
Collaborator

Couple things.

  1. I'm not sure why it suddenly became reproducible locally after I merged main. Could be that I re-ran npm install
  2. The failure here was simply that the element in was very slightly in the viewport (not sure why that changed). The error message from playwright about that happens to be very opaque.
  3. The fix is to scroll 5px farther.
image

Comment thread app/layouts/helpers.tsx
</main>
</div>
<div className="sticky bottom-0 flex-shrink-0 justify-between overflow-hidden border-t bg-default border-secondary empty:border-t-0">
<div className="sticky bottom-0 z-popover flex-shrink-0 justify-between overflow-hidden border-t bg-default border-secondary empty:border-t-0">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might conflict with actual popovers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

This seems to be fine because all of the popovers are in portals and therefore appears later in the DOM. I could add a z-bottomBar or something that is z-index: 5; (popover is currently 10).

@benjaminleonard

Copy link
Copy Markdown
Contributor Author

Would love to get this into release 8 – in part because it touches so many files the longer it sits the more painful any merge conflicts are going to be.

@david-crespo

Copy link
Copy Markdown
Collaborator

This is beautiful work but because it's hard to say it's a priority and it has so many moving parts (and is getting more and more out of date), I think we'll want to break it into chunks (as far as that's possible) and redo each one as a new PR on top of main.

@benjaminleonard

Copy link
Copy Markdown
Contributor Author

The important part here is fixing the parts that break on smaller desktop sizes currently. And removing the grid layout is necessary I think for fixing the scrolling bug on the instance create (and other screens) – which is probably the most invasive change.

Happy for this to be split out, though I'd be doubtful that would be less work than spending a bit of time testing this. If we deployed this as early on the dogfood cycle before the next release, and did some extra checks on our end then the scope for harm is pretty low. Especially since our e2e coverage is pretty good.

@david-crespo

Copy link
Copy Markdown
Collaborator

I merged main and it all seems to work, so we're in better shape than I expected. Here's one easy thing to fix — needs a max-w or a slightly smaller hard width.

image

Comment thread app/components/TopBar.tsx
return (
<>
<div className="flex items-center border-b border-r px-3 border-secondary">
<div className="fixed top-0 z-topBar col-span-2 grid h-[var(--navigation-height)] w-full grid-cols-[min-content,auto] bg-default lg+:grid-cols-[var(--sidebar-width),auto]">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this stuff freaks me out. wonder if we can drop the grid cols thing

@david-crespo

Copy link
Copy Markdown
Collaborator

let's redo this in bits

david-crespo added a commit that referenced this pull request Apr 22, 2026
)

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.

- Viewport meta tag: proper responsive width=device-width instead of
fixed width=1050
- CSS: add --sidebar-width variable, responsive --content-gutter
(smaller below 1000px), remove overflow-y-hidden on body, set height:
100% on html/body/#root
- TopBar: single fixed element (was two Fragment children occupying grid
cells)
  - Sidebar: fixed position with overflow scroll
- ContentPane: margin-left offset for sidebar, document-level scroll via
min-h-[calc(100vh-...)]
  - Scroll restoration: window.scrollY instead of container .scrollTop
  - PageSkeleton: matches new fixed layout structure
- E2e: scroll-restore test updated for document scroll,
expectScrollTop/scrollTo utils use window
  
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
- [x] Fix table dropdown overlapping header
- [x] Double check modals are not causing layout shift

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: David Crespo <[email protected]>
david-crespo pushed a commit that referenced this pull request Aug 30, 2026
… 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
david-crespo pushed a commit that referenced this pull request Aug 30, 2026
1000px was high enough to give narrower desktop windows (e.g., half-screen
on a small laptop) the phone hamburger layout. At 800px, every window that
gets the desktop layout on main still does; only genuinely small ones get
the overlay nav.

Also grow the sidebar toggle from a 32px box with a 12px glyph to a 40px
box with a 16px glyph — the old proportions came straight from #2087 and
were undersized both visually and as a tap target.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018fdQ4zKzMdoxiJLQkLWo6k
@david-crespo david-crespo mentioned this pull request Sep 1, 2026
david-crespo added a commit that referenced this pull request Sep 1, 2026
#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.
david-crespo added a commit that referenced this pull request Nov 20, 2026
Adding back some fixes from the very first PR (#2087) and more general
improvements.

We can also log any other responsive funkiness to fix here.

---

**1. Date range picker** — below 1000px the date text is
screen-reader-only and the control is the calendar icon.

<img width="483" height="554" alt="image"
src="https://github.com/user-attachments/assets/52f8a405-8d28-4132-95c9-3abeca300e4d"
/>

**2. Properties table** — labels stack above values so long IDs don’t
overflow. Two-column tables still sit side-by-side from 1000px up.

<img width="480" height="236" alt="image"
src="https://github.com/user-attachments/assets/5f03f75d-4d26-4098-94dd-d0d0b4cc1a7b"
/>

**4. Sticky tabs** — page tab lists stick under the top bar. Sticky is
on a wrapper so it doesn’t fight horizontal scroll. Form tab lists
(instance create) stay in flow.

<img width="484" height="225" alt="image"
src="https://github.com/user-attachments/assets/5346d7d4-4834-44b2-9a12-adcfcb03c80b"
/>

**5. Metrics / utilization filters** — toolbars stack and listboxes go
full width. Instance metrics side tabs (CPU / Disk / Network) move to a
horizontal row so they don’t eat half the phone.

**6. CLI command** — hidden below 1000px on Connect and the serial
console footer.

**7. Adjust menu icon button size** — fills cell and narrower

<img width="431" height="87" alt="image"
src="https://github.com/user-attachments/assets/6e4b0a4b-969c-47d0-879a-cfa9423be9ab"
/>

**8. Fix error message container width**

**9. Tighter pagination footer density**

**10. Improve card header button wrapping**
<img width="481" height="349" alt="image"
src="https://github.com/user-attachments/assets/09dd3154-9fe9-40de-8d42-8547e6942f9f"
/>

**11. Improve page header wrapping and truncation**
<img width="506" height="162" alt="image"
src="https://github.com/user-attachments/assets/34f73385-0c9f-4beb-9b46-74eebee92d00"
/>
<img width="472" height="148" alt="image"
src="https://github.com/user-attachments/assets/1ae99998-a091-426b-829e-4ff683adc8da"
/>

**12. Avoid sticky tab bar overlapping main top bar and disable
overscroll bounce**

---

Todo:

- [ ] Can't see disk name in mini-table (additional disks)

---------

Co-authored-by: David Crespo <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 75dc134b Deployed Sep 16, 2024 by vercel[bot]
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.

2 participants