Skip to content

docs(swingset): align dialog docs with archetype guidance#8892

Open
kylemac wants to merge 1 commit into
mainfrom
kylemac/update-dialog-mdx-docs
Open

docs(swingset): align dialog docs with archetype guidance#8892
kylemac wants to merge 1 commit into
mainfrom
kylemac/update-dialog-mdx-docs

Conversation

@kylemac

@kylemac kylemac commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

TLDR

Description

Brings the two swingset Dialog doc pages in line with the documentation archetypes in packages/swingset/CLAUDE.md. The Mosaic component page (/components/dialog) is restructured to the knob-driven archetype: a live <Preview> playground followed by an interactive <PropTable> (knob Value column, no description) positioned above the rest of the page. The headless primitive page (/primitives/dialog) is corrected against the actual @clerk/headless source — it now documents the missing Dialog.Viewport part, moves lockScroll from Backdrop to Viewport (which actually owns scroll lock), drops a fabricated Portal "scoped mode," and clarifies that data-cl-slot is applied by the styled Mosaic layer (not the headless parts). To test: run pnpm run dev:swingset and visit /components/dialog (confirm the size knob drives the preview) and /primitives/dialog. Docs-only change to a private, unpublished package, so the changeset is empty.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Restructure the Mosaic Dialog component page (/components/dialog) to the knob-driven archetype: live Preview playground with an interactive PropTable above the examples. Correct the headless Dialog primitive page (/primitives/dialog) to document Dialog.Viewport, fix scroll-lock ownership, and clarify that data-cl-slot is applied by the styled layer.
@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 05ac390

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jun 17, 2026 2:43pm
swingset Ready Ready Preview, Comment Jun 17, 2026 2:43pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Documentation-only update to the Dialog headless primitive: restructures the usage example to nest Dialog.Popup inside Dialog.Viewport, adds a non-modal section, documents new root and lockScroll props, rewrites the styling section to use class+state-attribute selectors, and switches the component story to a generated PropTable.

Changes

Dialog Documentation Update

Layer / File(s) Summary
Component story: Playground preview and dynamic PropTable
packages/swingset/src/stories/dialog.component.mdx
Replaces the static example and hand-written props table with a Playground Preview and a PropTable generated from story meta. Adds Popup to the data-cl-open/data-cl-closed attribute coverage.
Headless docs: intro, usage example, non-modal section, parts table
packages/swingset/src/stories/dialog.mdx
Revises the intro description, updates the usage example to use Dialog.Backdrop and Dialog.Viewport as siblings with Dialog.Popup nested inside the viewport, adds a "Non-modal" section for modal={false}, and updates the Parts table with revised part responsibilities and nesting rules.
Headless docs: props expansion and styling rewrite
packages/swingset/src/stories/dialog.mdx, .changeset/bold-horses-rhyme.md
Documents root on Dialog.Portal and lockScroll on Dialog.Viewport, rewrites the styling section to remove data-cl-slot references, updates the data-cl-* attribute table to include Viewport, and updates the CSS example to .dialog-popup[data-cl-*] selectors. Adds changeset entry.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • clerk/javascript#8819: Directly introduces/updates the same Dialog headless primitive docs in dialog.mdx and dialog.component.mdx.
  • clerk/javascript#8886: Updates PropTable rendering behavior (new Default column/value display) that the switched-over props table in this PR would consume.
  • clerk/javascript#8822: Modifies PropTable badge-style prop name display, directly affecting the generated props table added in this PR.

Suggested reviewers

  • alexcarpenter

🐇 A viewport wraps the popup just right,
No data-cl-slot to fight—
Lock scroll with lockScroll, stay true,
modal={false} lets the page shine through.
The docs hop forward, fresh and bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly summarizes the main change: updating Dialog documentation to align with established documentation archetypes in the swingset package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8892

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8892

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8892

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8892

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8892

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8892

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8892

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8892

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8892

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8892

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8892

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8892

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8892

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8892

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8892

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8892

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8892

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8892

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8892

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8892

commit: 05ac390

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/swingset/src/stories/dialog.component.mdx`:
- Around line 10-31: The dialog.component.mdx file is missing the required
Examples section which is mandatory for Archetype A documentation. The file
currently contains Playground, Props, and Usage sections, but according to
guidelines, the Examples section must be included after Usage. Add an Examples
section after the Usage section heading with relevant code examples
demonstrating how to use the Dialog component in different scenarios.
- Around line 19-28: The PropTable component in the dialog.component.mdx file
has an extra array with prop definitions where some props are missing the
default field. Add a default property to each prop object in the extra array
that currently lacks one (trigger, children, open, and onOpenChange). For props
without a meaningful default value, use "—" as the default to comply with the
props table documentation standards. Ensure all prop objects in the extra array
now include an explicit default field.

In `@packages/swingset/src/stories/dialog.mdx`:
- Around line 5-6: The documentation in the Dialog component description
incorrectly presents focus trapping as unconditional behavior, but the component
supports a modal={false} option where focus is not trapped. Locate the
introductory description around line 5-6 that states the component "traps focus
until dismissed" and the Dialog.Popup description around line 69, then add
qualifying language such as "in modal mode" or "by default" to both locations to
clarify that focus trapping only occurs when the modal prop is enabled. This
ensures the documentation accurately reflects that focus trapping is conditional
behavior rather than a default always-on feature.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 3edb52ee-d884-4250-bbd1-378170795c4b

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 05ac390.

📒 Files selected for processing (3)
  • .changeset/bold-horses-rhyme.md
  • packages/swingset/src/stories/dialog.component.mdx
  • packages/swingset/src/stories/dialog.mdx

Comment on lines +10 to 31
## Playground

<Story
<Preview
name='Default'
storyModule={DialogStories}
/>

## Props

<PropTable
meta={DialogStories.meta}
extra={[
{ name: 'trigger', type: '(props: HTMLAttributes<HTMLElement>) => ReactElement' },
{ name: 'children', type: 'ReactNode | ((ctx: { close: () => void }) => ReactNode)' },
{ name: 'open', type: 'boolean' },
{ name: 'defaultOpen', type: 'boolean', default: 'false' },
{ name: 'onOpenChange', type: '(open: boolean) => void' },
{ name: 'modal', type: 'boolean', default: 'true' },
]}
/>

## Usage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add the required Examples section for Archetype A docs.

This page currently has Playground → Props → Usage but omits Examples, which is required for Archetype A MDX docs.

As per coding guidelines: “For Archetype A (simple CVA) MDX files, required sections in order: Playground, Props, Usage, then Examples. Never reorder or omit these sections.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/swingset/src/stories/dialog.component.mdx` around lines 10 - 31, The
dialog.component.mdx file is missing the required Examples section which is
mandatory for Archetype A documentation. The file currently contains Playground,
Props, and Usage sections, but according to guidelines, the Examples section
must be included after Usage. Add an Examples section after the Usage section
heading with relevant code examples demonstrating how to use the Dialog
component in different scenarios.

Source: Coding guidelines

Comment on lines +19 to +28
<PropTable
meta={DialogStories.meta}
extra={[
{ name: 'trigger', type: '(props: HTMLAttributes<HTMLElement>) => ReactElement' },
{ name: 'children', type: 'ReactNode | ((ctx: { close: () => void }) => ReactNode)' },
{ name: 'open', type: 'boolean' },
{ name: 'defaultOpen', type: 'boolean', default: 'false' },
{ name: 'onOpenChange', type: '(open: boolean) => void' },
{ name: 'modal', type: 'boolean', default: 'true' },
]}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Provide defaults for every prop in the generated props table input.

In extra, several props (trigger, children, open, onOpenChange) do not declare a default. Please set explicit defaults (typically ) so the rendered table stays compliant and unambiguous.

As per coding guidelines: “In all props tables, document the default value for every prop in a dedicated Default column … use when there is no default.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/swingset/src/stories/dialog.component.mdx` around lines 19 - 28, The
PropTable component in the dialog.component.mdx file has an extra array with
prop definitions where some props are missing the default field. Add a default
property to each prop object in the extra array that currently lacks one
(trigger, children, open, and onOpenChange). For props without a meaningful
default value, use "—" as the default to comply with the props table
documentation standards. Ensure all prop objects in the extra array now include
an explicit default field.

Source: Coding guidelines

Comment on lines 5 to 6
A modal window that overlays the page and traps focus until dismissed, from
`@clerk/headless`. It is a **headless** primitive: it supplies open state, portalling, an

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify focus-trap wording as modal-only behavior.

The intro and Dialog.Popup description read as unconditional focus trapping, but this page also documents modal={false} where focus is not trapped. Please qualify these lines as “in modal mode” (or “by default”).

Also applies to: 69-69

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/swingset/src/stories/dialog.mdx` around lines 5 - 6, The
documentation in the Dialog component description incorrectly presents focus
trapping as unconditional behavior, but the component supports a modal={false}
option where focus is not trapped. Locate the introductory description around
line 5-6 that states the component "traps focus until dismissed" and the
Dialog.Popup description around line 69, then add qualifying language such as
"in modal mode" or "by default" to both locations to clarify that focus trapping
only occurs when the modal prop is enabled. This ensures the documentation
accurately reflects that focus trapping is conditional behavior rather than a
default always-on feature.

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