Skip to content

Fixed table column widths and column resizing - #3457

Open
benjaminleonard wants to merge 19 commits into
mainfrom
fixed-column-widths
Open

benjaminleonard wants to merge 19 commits into
mainfrom
fixed-column-widths

Conversation

@benjaminleonard

@benjaminleonard benjaminleonard commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
CleanShot 2026-11-24 at 15 22 12

Currently column widths are inferred from content so you end up with tables that dance around during pagination or when cells load content async. This sets column widths as part of the column meta and gives the user the ability to adjust the column widths with a little handle on the header.

Example of cell pop-in this PR fixes:
CleanShot 2026-12-01 at 11 34 52


  • Table renders a <colgroup> and uses table-layout: fixed, so widths come only from the column defs.
    • Widths live in meta.width, not TanStack's size. size defaults to 150, so it can't mark a column as flexible.
  • A column with meta.width: 'flex' shares whatever space the fixed columns leave. That's usually the name column.
    • The table's min-width is the sum of the fixed widths plus 160px for each flexible column. Below that, the table scrolls instead of squashing.
  • ColWidth in app/table/columns/common.tsx (xs 96 … xl 208, plus date, description, id and ip), so the same kind of column is the same width on every table.
  • Plain-text cells and headers truncate with an ellipsis, and the full text shows in a tooltip.
  • Most kinds of column get their width from Columns without anyone choosing one. New helpers: ipVersion, poolType, diskType, diskState, diskSource, instance(tab), imageOs, imageVersion, identityType and serial, alongside the existing timeCreated, description, id and size.
  • Converts Silo Quotas, System Utilization and the internet gateway routes table to TanStack, moves Snapshots' description after created."

Every column must have a width, and we wrap the createColumnHelper to require meta.width with tsc. Groups are exempt because they take their width from their child columns.

Column resizing

  • 96px minimum; maximum is 3× the average column width (visible width ÷ column count).
  • If no flexible column is left, the spare width is split evenly between the columns nobody has dragged. Actions stays at the right edge.
  • Widths are kept per table (useTable requires an id) in a zustand store: they survive navigation, not refresh.

Screenshots

Instances 03-instances
Disks 04-disks
IP pools 05-ip-pools
Resize handle, hover 06-handle-hover
Resize handle, dragging 07-handle-dragging
Header truncated at minimum width 08-truncated-headers
Resize handle, light theme 09-handle-hover-light
Filler column when smaller than table width CleanShot 2026-12-01 at 12 32 25

The table's outer border used to be painted by the edge cells, with ::after
overlays faking the rounded corners. When a table without a sticky actions
column overflowed, its right edge scrolled away and the border was left open.

- Draw the border with a frame element pinned to the visible part of the
  scroller (sticky, sized with 100cqw), so it stays closed at any scroll
  position. Edge cells keep transparent 1px borders so column widths match.
- Replace simplebar-react with a native scrollbar styled to match
  (::-webkit-scrollbar, scrollbar-color in Firefox), keeping 16px below the
  table whether or not it overflows.
- Remove the corner overlays and !important overrides from table.css.
- Draw row selection as one outline per row, merging adjacent rows with
  :has(), instead of box-shadow hacks on every cell. Removes the
  cloneElement pass in Table.Body.
- Fade sticky column shadows in and out with scroll-state container queries
  where supported, falling back to the scroll-driven animations. Tables with
  no actions column get a matching shadow at the right edge while there's
  more to scroll to.
- Table's className now applies to the outer box, so sizing classes like
  max-w-lg size the frame too.
- Add narrow-viewport overflow cases to the visual regression suite.

Not pixel-identical to before: two old quirks (no left border on the
bottom-left cell, -m-px on last-column cells) skewed column widths, so some
columns shift by a fraction of a pixel, and two-column tables are 1px taller.
- Set overscroll-behavior-y: none on html as well as body so the app shell
  never rubber-bands, whichever element the browser treats as the viewport
- Use overscroll-contain on side modal, modal and sidebar scrollers so they
  keep their native end-of-content bounce without chaining to the page
- Disable overscroll entirely on menus, dropdowns and popovers, where a
  bounce on a small floating panel looks broken
Tables used auto layout, so columns resized themselves between pages and
as async cells loaded. Every column now has a set width and the table uses
fixed layout, so widths no longer depend on content.

- Table renders a colgroup from meta.width. 'flex' columns share the space
  left over, and plain-text cells and headers truncate.
- createColumnHelper in ~/table/column-helper requires meta.width on every
  column, and lint blocks importing TanStack's own.
- New shared Columns helpers carry widths for the common kinds of column.
- Columns can be resized by dragging header edges, and reset with a
  double-click. Sizes live in a zustand store keyed by table, kept across
  navigation but not persisted.
- Snapshots: description moved after created.
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
console Ready Ready Preview Dec 1, 2026 12:27pm UTC

Request Review

- useTable and useQueryTable require an id, which keys each table's
  widths in the sizing store. Tables no longer share sizes just because
  they have the same columns.
- Resizing uses its own drag code. A dragged column becomes fixed, from
  min 96px to max 3x the average column width. Once no flexible column is
  left, the spare width is split evenly between the columns nobody has
  dragged, measured from the scroll container.
- The handle is positioned against the th so the bar sits flush with
  the divider on every column, not only the sticky first one.
- Silo Quotas, System Utilization and the internet gateway routes table
  now use TanStack.
- useTable defaults autoResetPageIndex to false. Pagination is
  server-side, and the reset looped forever when data was derived during
  render (e.g. Silo Quotas froze on opening Edit quotas).
@benjaminleonard

Copy link
Copy Markdown
Contributor Author

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Findings marked 🟡 are optional suggestions and need no follow-up push.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🟡 app/table/Table.tsx — A resize drag can get stuck: after a cancelled touch or a right-click, the column keeps following the pointer and the table stays in resizing mode. startResize handles any mouse button and listens only for mouseup/touchend, so it never ends when those events don't arrive. Fix: make every drag end reliably. Start only on a primary-button press (e.button === 0) and end on touchcancel as well. Pointer events with setPointerCapture plus pointercancel/lostpointercapture would cover all of these cases.

    Why this was flagged

    The ResizeHandle's onMouseDown/onTouchStart (Table.tsx:147-148) call startResize (Table.tsx:261) without checking which button was pressed. It adds a document mousemove/touchmove listener and removes it only in onEnd, which runs on mouseup/touchend (Table.tsx:275-285). When the OS cancels a touch (a system gesture, an incoming call, a multi-touch interruption), touchcancel fires instead of touchend. Likewise, a right-click or macOS ctrl-click on the handle opens the native context menu, which can swallow the mouseup. In both cases the listeners stay attached and columnSizingInfo.isResizingColumn stays set. The table keeps the ox-table-resizing class (col-resize cursor, user-select: none). The next pointer movement anywhere on the page resizes that column relative to the stale startX, until some later mouseup or touchend. This handle is new in this PR, so the base branch has no such stuck state.

    Verification: Severity: nit. In app/table/Table.tsx, lines 147-148 start a resize on any mouse button, and lines 127-130 listen only for mouseup/touchend, with no touchcancel handler. If the context menu swallows mouseup or a touch is cancelled, the column width tracks the pointer (lines 122-126) and ox-table-resizing stays (line 175). This is new code; the next mouseup or touchend recovers.

Comment thread app/table/use-table.ts Resolved
Comment thread app/table/cells/LinkCell.tsx Resolved
Comment thread app/ui/styles/components/table.css Resolved
Base automatically changed from table-frame-refactor to main December 1, 2026 02:45
Badges in cells shrink and ellipsize within their padding and ring rather than
being clipped at the cell edge. State badges wrap their text so it can show an
ellipsis, and a trailing-badge class keeps a few characters of a name before
the badge beside it gives way. Cells now use the same padding on both sides.
…actions

On wide screens, flexible columns stop at 480px and an empty spacer column
takes the rest, so every column renders at its own width and dragging one
no longer redistributes the others. Resize observer updates flush before
paint so shrinking the window doesn't flash a scrollbar.
The content gutter grows past --content-max-width instead of each page
capping itself, so full-bleed tabs, dividers, and the page footer line up
with the centered content. Registered with @Property so it resolves against
the content pane rather than nested containers.
This reverts commit 41f9b14, which now lives on content-max-width.
Name columns scroll the table before going below 224px, and descriptions
grow into spare room but never below their old fixed 240px. Fixed layout
ignores minimums when sharing space, so columns whose even share would fall
short are pinned at their minimum. Also widens the custom router column,
fixes model number at 224px, and gives VPC subnet IP blocks room for IPv6.
- Use one module-level default column so plain-text cells keep their
  ellipsis and headers their tooltip after a re-render. TanStack rebuilds
  its own defaults whenever defaultColumn changes identity.
- Render plain-text link and button cells through Truncate so cut-off
  names get a tooltip.
- Keep the last column's resize handle inside the table so tables that
  fit don't scroll by a few px.
- Resize with pointer capture, ending on lostpointercapture, and ignore
  secondary clicks, so a drag can't get stuck.
- Match the Pool field exactly or within its dialog in e2e tests, since
  pool names in tables now carry an aria-label.
} from '@tanstack/react-table'
import { create } from 'zustand'

/** Keyed by table (see `useTable`). Not persisted on purpose: a refresh resets widths. */

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 might decide to revisit this, but seems much simpler

Widths live on the colgroup, so the body only needs to re-render when rows,
columns, or the spacer change. On a 1000-row table this cut a window resize
frame from ~214ms to ~63ms of main-thread time (same as main) and a column
drag move from ~189ms to ~36ms. Also memoizes columns on the snapshots and
affinity pages, which rebuilt them every render and so re-rendered every row.

This branch was successfully deployed

1 active deployment
Preview — 486c27cb Deployed Dec 1, 2026 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