Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(quill): let table max-h-* scroll instead of clipping rows (#87623)

posthog[bot]82add5ec73c5
diff --git a/packages/quill/packages/primitives/AGENTS.md b/packages/quill/packages/primitives/AGENTS.md
index e2e1c60c0a58..68a06b1d6630 100644
--- a/packages/quill/packages/primitives/AGENTS.md
+++ b/packages/quill/packages/primitives/AGENTS.md
@@ -1016,6 +1016,8 @@ Compose `Table > TableHeader/TableBody/TableFooter > TableRow > TableHead/TableC
**Backgrounds: transparent by default, opaque when sticky.** Plain cells and headers are transparent, so a `Table` inherits whatever surface it sits on (inside a `Card`, a tinted panel). Sticky parts (`stickyHeader`, `stickyHeader="page"`, `sticky="left"/"right"`) get an opaque background automatically — they'd otherwise bleed scrolled-under content — so you don't add `bg-background` yourself. It defaults to the app background; if the table sits on a different surface, override the inherited `--quill-table-sticky-bg` custom property on the `Table` so the frozen cells match — e.g. inside a `Card`, `className="[--quill-table-sticky-bg:var(--card)]"`.
+**Bounding the height — `h-*` or `max-h-*` both scroll.** A height class on the `Table` (it lands on the root wrapper) makes the body scroll past that height; pair it with `stickyHeader` to freeze the header. Both a definite height (`h-96`) and a bare cap (`max-h-[44rem]`) work — the scroll viewport reads the cap through `max-height: inherit`, so `max-h-*` no longer clips rows without a scrollbar.
+
**Empty state — use `TableEmpty`, not a hand-rolled cell.** Drop `TableEmpty` in where a `TableBody` would go; it renders its own `tbody > tr > td` with a full-span `colSpan` (defaults huge, browsers clamp to the real column count) and centers its content. Put `<Empty>` or plain text inside — no manual `colSpan`, no `h-full`. To make it fill the body area, give the `Table` a height (e.g. `className="h-full"` with a height-bounded container); otherwise it sizes to its content. Don't put an `<Empty>` (a `div`) as a direct child of `Table` — that's invalid table markup and the browser hoists it out of the grid.
```tsx
diff --git a/packages/quill/packages/primitives/src/table.css b/packages/quill/packages/primitives/src/table.css
index cdf3e5449849..6ff2b740bc75 100644
--- a/packages/quill/packages/primitives/src/table.css
+++ b/packages/quill/packages/primitives/src/table.css
@@ -29,10 +29,15 @@
--tbl-edge-shadow: rgb(0 0 0 / 55%);
}
- /* Viewport — owns the scroll; fills the root. */
+ /* Viewport — owns the scroll; fills the root. `max-height: inherit` passes a
+ `max-h-*` set on the root down to the scroller, so the viewport caps and
+ scrolls at that height instead of growing to full content height (a `height:
+ 100%` against a max-height-only parent resolves to auto, which the root then
+ clips with no scrollbar). A definite height on the root still wins. */
.quill-table__viewport {
width: 100%;
height: 100%;
+ max-height: inherit;
overflow: auto;
}
diff --git a/packages/quill/packages/primitives/src/table.stories.tsx b/packages/quill/packages/primitives/src/table.stories.tsx
index 8a51a39d17aa..ac61fd76b67b 100644
--- a/packages/quill/packages/primitives/src/table.stories.tsx
+++ b/packages/quill/packages/primitives/src/table.stories.tsx
@@ -767,8 +767,8 @@ export const InCardMinHeight: Story = {
),
} satisfies Story
-// Sticky header inside a Card: a definite height (`h-96`, not `max-h-*` — the
-// scroll viewport needs a resolved height) makes the body scroll, and
+// Sticky header inside a Card: a bounded height (`h-96` here; `max-h-*` also
+// scrolls, via the viewport's `max-height: inherit`) makes the body scroll, and
// `stickyHeader` freezes the header. Because the table sits on the card surface
// (not the app background), override `--quill-table-sticky-bg` to `var(--card)`
// so the frozen header matches — here via a Tailwind arbitrary property.