Skip to content

feat(sheet): floating side sheet that mounts in a container - #156

Merged
riccardoperra merged 1 commit into
mainfrom
feat/sheet-side-drawer
Nov 29, 2026
Merged

riccardoperra merged 1 commit into
mainfrom
feat/sheet-side-drawer

Conversation

@riccardoperra

Copy link
Copy Markdown
Owner

Why

CodeLoom's Automations page needs a right-side panel for automation details and the create/edit form. DESIGN.md §1 rule 8 (one component per pattern) says extend Sheet, so there is no new Drawer. Before this change the Sheet had no exit animation at all: Kobalte alpha.5 unmounts a closed dialog at once.

What changed

  • side="left" | "right" floats 8px in from the top, bottom and its edge, with every corner rounded. It is 24rem wide by default (--cui-sheet-width). At ≤768px it becomes a bottom sheet, and draggable shows the grip there only.
  • mount set to anything other than document.body makes the content and scrim position: absolute (data-contained), so they cover that element. For CodeLoom that is the content island, not the sidebar.
  • Motion uses transitions instead of keyframes: enter 260ms (slow) on --cui-motion-ease-drawer, exit 200ms (panel) ease-out, and the scrim fades with it. The root holds the content through the exit (createPopMotion now takes an exit predicate). Reopening mid-exit turns the slide around. Keyboard opens and closes still don't animate. Reduced motion fades in place.
  • --cui-motion-ease-drawer is promoted from proposed to a real token.
  • Changing the children while the sheet is open swaps them in place. Stories: Sheet/Drawer (modal) and Sheet/Drawer Nonmodal (row clicks swap the content).

Scope

The brief targeted feat/upgrade-solid2-kobalte. That branch merged into main as #141 and was deleted, so this PR is rebased onto main and uses the renamed package, @codeui/solid.

Tradeoffs

  • The sheet passes disableOutsidePointerEvents={false}. Kobalte's body pointer-events: none outlived the close (its effect cleanup runs while the layer still counts as blocking), so every click during the exit was lost. The scrim catches outside clicks instead. A parts user with a modal sheet and no Overlay now lets clicks reach the page.
  • A nonmodal sheet next to a list needs contentProps.onInteractOutside → preventDefault() on row targets. Otherwise a row click dismisses it first. This is documented and the story shows it.
  • The enter uses 260ms (slow) instead of the 280ms in DESIGN's old Slide row, so no new duration token is needed. DESIGN.md is updated to match.

Blast Radius

Sheet consumers. Side sheets change look (inset, rounded) and turn into bottom sheets on a phone. The SheetPlacement union is now a plain object, because draggable is allowed on every side. Popover and menu exits share createPopMotion, which keeps its default Pop predicate.

Verification

  • kit: 766/766 tests in two full runs. A third run had one failure in a Select pop-exit timing test, which passes 3/3 alone. New tests cover container coverage, exit hold with the page clickable during it, mid-exit reversal, and the desktop/phone grip and focus. Reverting the pointer-events fix makes the exit test fail.
  • styles, inkstone, the token tests, api:check and docs:lint pass. docs:check-llms needs a running docs URL and was not run.
  • verify-codeui in dark and light: journeys/sheet-drawer.mjs 10/10 and journeys/sheet-swap.mjs 3/3, with axe clean in every state. The motion numbers, measured with scripts/sheet-motion.mjs, are in the first comment.

🤖 Generated with Claude Code

CodeLoom's Automations page needs a right-side panel for automation
details and the create/edit form. Extend Sheet instead of adding a
Drawer:

- Left and right sheets float 8px in from the edges with every corner
  rounded, and become a bottom sheet at 768px and below, where
  `draggable` shows the grip.
- A `mount` other than document.body makes the sheet and its scrim cover
  that element (data-contained, position: absolute).
- The slide is a CSS transition: in 260ms on the new
  --cui-motion-ease-drawer token, out 200ms ease-out. The root holds the
  content through its exit and a reopen mid-exit turns it around.
- The page takes clicks during the exit. Kobalte's body pointer lock
  outlived the close, so the sheet relies on its scrim instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7100f31

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@codeui/solid Minor
@codeui/styles Minor
@codeui/inkstone Minor
@codeui/storybook-playground Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@riccardoperra

Copy link
Copy Markdown
Owner Author

Motion, before and after (right sheet, designsystem-sheet--sides, Chromium, motion on)

Measured with node .claude/skills/verify-codeui/scripts/sheet-motion.mjs <url> designsystem-sheet--sides "Open (right)" [reduce], which samples getAnimations() and the computed transform and opacity of the content.

Moment Before After
Pointer open @keyframes slide, 200ms ease-out, edge-attached transition: transform 260ms, cubic-bezier(0.32, 0.72, 0, 1), floating 8px inset
Scrim in keyframe fade 200ms opacity transition 260ms ease-out
Pointer close, +30ms already unmounted (no exit) still mounted, transform transition 200ms ease-out, at 132px
Pointer close, +150ms gone at 389px, scrim opacity 0.007
Page during exit body pointer-events: none until unmount clickable (scrim and content inert)
Reopen 80ms into the exit n/a turns around from 344px (no restart)
Keyboard open or close data-motion="none", no motion unchanged
Reduced motion keyframe fade in, no exit opacity only, 260ms in and 200ms out, transform none
Phone (≤768px) side sheet stays a 24rem side panel bottom sheet, translateY(100%), grip shown

Browser evidence

  • journeys/sheet-drawer.mjs on designsystem-sheet--drawer, dark and light: closed, then Enter on "New automation" (focus inside, data-motion=none, 8px insets, scrim limited to the island), Escape returns focus, Enter on a row, Edit swaps in place on the same element, a scrim click returns focus to the row, and at 390×844 a full-width bottom sheet with the grip. Axe: no violations in any state.
  • journeys/sheet-swap.mjs on designsystem-sheet--drawer-nonmodal: a row click while open swaps the title. The same element keeps data-expanded the whole time (MutationObserver).

@github-actions

Copy link
Copy Markdown
Contributor

CodeUI package preview

Built from 7100f31.

npm install https://pkg.pr.new/riccardoperra/codeui/@codeui/solid@7100f3187acf80660c11f5fee4d9876d206ad722

Installing @codeui/solid also installs matching previews of @codeui/styles and @codeui/inkstone.

@github-actions

Copy link
Copy Markdown
Contributor

Docs preview deployed to Cloudflare Pages.

Built from 7100f31.

@riccardoperra
riccardoperra merged commit cbb0364 into main Nov 29, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
docs-preview — 7100f318 Deployed Nov 29, 2026 by riccardoperra via Deploy to Cloudflare Pages #179
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.

1 participant