Skip to content

docs(swc): convert 2nd-gen pattern and controller story JSDoc to per-unit MDX#6351

Open
caseyisonit wants to merge 26 commits into
mainfrom
caseyisonit/docs-mdx-patterns
Open

docs(swc): convert 2nd-gen pattern and controller story JSDoc to per-unit MDX#6351
caseyisonit wants to merge 26 commits into
mainfrom
caseyisonit/docs-mdx-patterns

Conversation

@caseyisonit
Copy link
Copy Markdown
Contributor

@caseyisonit caseyisonit commented May 28, 2026

Description

Follow-up to PR #6349 (components). Move long-form documentation that previously lived as JSDoc comments above story exports in .stories.ts files into per-unit MDX files at each unit's root, for the remaining 2nd-gen genres: conversational AI patterns and the focusgroup navigation controller.

Scope (this PR): 11 patterns + 1 controller.

  • Patterns (2nd-gen/packages/swc/patterns/conversational-ai/<name>/<name>.mdx):
    • system-message, suggestion-item, conversation-turn, message-sources, upload-artifact, user-message, suggestion-group, message-feedback, response-status, prompt-field, conversation-thread
  • Controller (2nd-gen/packages/core/controllers/focusgroup-navigation-controller/focusgroup-navigation-controller.mdx):
    • Validates the controller branch of DocsFooter, which auto-omits <ApiTable /> (controllers expose a TypeScript class, not a custom element manifest) and renders a hand-authored ## API section instead.

This branch is based on caseyisonit/docs-to-mdx. Merge that PR first; this PR contains pattern + controller changes only.

Motivation and context

Same as PR #6349: story-level JSDoc was the only mechanism for long-form prose attached to each story, which forced documentation-only stories (tags: ['description-only']) and section-order parameters to influence rendering order. Per-unit MDX provides:

  • A single, hand-authored source of truth per pattern/controller, with explicit <Canvas of={Story} /> references.
  • Prose-only sections without fake stories: description-only stories are deleted; their prose lives in MDX as Canvas-less sections (e.g. the controller's Usage, API, Accessibility, Appendix prose).
  • Exact reuse of the DocsHeader / DocsFooter blocks shipped in PR docs(swc): convert 2nd-gen component story JSDoc to per-component MDX #6349 — no new infrastructure.

Related issue(s)

Screenshots (if appropriate)

Visual parity verified by spot-checking system-message, conversation-thread, and the focusgroup-navigation-controller Docs pages against the template-driven rendering.

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Per-pattern Docs pages render via MDX

    1. Run yarn storybook in 2nd-gen/packages/swc/
    2. Open each of: /docs/patterns-conversational-ai-system-message--docs, patterns-conversational-ai-suggestion-item--docs, patterns-conversational-ai-conversation-turn--docs, patterns-conversational-ai-message-sources--docs, patterns-conversational-ai-upload-artifact--docs, patterns-conversational-ai-user-message--docs, patterns-conversational-ai-suggestion-group--docs, patterns-conversational-ai-message-feedback--docs, patterns-conversational-ai-response-status--docs, patterns-conversational-ai-prompt-field--docs, patterns-conversational-ai-conversation-thread--docs
    3. Expect: each page renders header (title, subtitle, description, overview), all applicable section headings (Anatomy, Options, States, Behaviors, Accessibility), and footer (Primary, Controls, Feedback link). No regressions versus the template-driven rendering.
  • Controller Docs page omits <ApiTable />

    1. Open /docs/core-controllers-focus-group-navigation-controller--docs
    2. Expect: page renders with ## What it does, ## Basic usage, ## Behaviors, ## Accessibility, ## API (hand-authored table — no auto-generated ApiTable), ## Appendix, and <Primary /> / <Controls /> from the playground. Confirm the Behaviors stories render correctly (HorizontalToolbar, BothAxesLinear, VerticalMenu, SkipDisabledMenu, Grid, ProgrammaticFocus, TextPrefixFocus).
  • No regressions in untagged stories

    1. Confirm conversation-thread's FullPattern story (no section tag) is not surfaced on the Docs page; it remains an opt-in story export.

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

Required: Complete each applicable item and document your testing steps.

  • Keyboard (required — document steps below)

    1. From the Docs page of any converted pattern or the controller, press Tab through the page.
    2. Expect: focus order moves through in-page anchor links (per section), then into interactive content inside each <Canvas> (form controls, prompt-field textarea, suggestion buttons, focus-group toolbar items, etc.).
    3. Confirm focus is visible at every stop and no focus traps exist inside <Canvas> regions.
    4. For the focusgroup-navigation-controller page, confirm the demo toolbars/menus/grids respond to Arrow keys, Home/End, and Page Up/Page Down per the documented behavior.
  • Screen reader (required — document steps below)

    1. With VoiceOver (macOS) or NVDA (Windows), navigate each converted Docs page by heading.
    2. Expect: heading levels read in canonical order — h1 (title), h2 (sections), h3 (per-story titles in hideTitle=false sections like Options/Behaviors), h4/h5 (JSDoc-derived subsections).
    3. Confirm each rendered story Canvas exposes its component(s) with role, name, and state as defined in the unit's accessibility behavior. No new announcements are introduced by the MDX wrapper itself.

caseyisonit and others added 25 commits May 28, 2026 12:26
Introduce two genre-aware Storybook doc blocks that own the standard top
and bottom of every per-unit docs page. Components, patterns, and
controllers compose a page as:

  <Meta of={Stories} />
  <DocsHeader />
  ...prose + Canvas references...
  <DocsFooter />

DocsHeader renders Title, StatusBadge, Subtitle, Description, the overview
story, and getting-started instructions. DocsFooter renders the API
section (skipping ApiTable for tag='controller'), Primary, Controls,
optional custom API stories, and the feedback link.

Rewrite DocumentTemplate.mdx in terms of the new blocks so the
template-driven docs page and the forthcoming per-unit MDX pages share
the exact same chrome with no duplicate boilerplate to drift.

Also adds research.md documenting the broader conversion plan.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
….mdx

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Auto-generated by update-nav.js for newly added migration analysis docs
(action-button, button-group, close-button, grid, infield-button, link
migration plan, popover migration plan, changelog strategy guide).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
….mdx

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…roup-navigation-controller.mdx

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

⚠️ No Changeset found

Latest commit: d48d771

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

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

Click here to learn what changesets are, and how to add one.

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

@caseyisonit caseyisonit added Component:Documentation Issues or PRs involving changes to docs or docs website. Component prefix is for Jira integration. Status:Ready for review PR ready for review or re-review. 2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. labels May 28, 2026
@caseyisonit caseyisonit marked this pull request as ready for review May 28, 2026 20:01
@caseyisonit caseyisonit requested a review from a team as a code owner May 28, 2026 20:01
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6351

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

Base automatically changed from caseyisonit/docs-to-mdx to main June 1, 2026 14:48
…patterns

# Conflicts:
#	2nd-gen/packages/swc/components/tabs/tabs.mdx
@rise-erpelding rise-erpelding self-assigned this Jun 1, 2026
@caseyisonit caseyisonit added the High priority PR review PR is a high priority and should be reviewed ASAP label Jun 1, 2026
Copy link
Copy Markdown
Collaborator

@rise-erpelding rise-erpelding left a comment

Choose a reason for hiding this comment

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

This one is looking pretty good also! Would love a response about the controller docs and a tiny change there before approving but otherwise, once we rebase with the previous PR, this should be good to go!

Comment thread research.md
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 should go away on its own once the .gitignore changes from the other branch are in!

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.

this should have been removed with the merge from main but ill make sure its gone before this merges.

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.

Hey, is this doc set to only be visible in Storybook when run locally? I don't see it in the preview build, just local. Do we want to surface this to consumers at some point?

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.

yeah this is an internal doc. i think thats a larger discussion down the road about core and when and what we expose. for the scope of this work i didnt change any architecture.

- [Keyboard navigation inside components (APG)](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#keyboardnavigationinsidecomponents)
- [Focusgroup explainer (Open UI)](https://open-ui.org/components/scoped-focusgroup.explainer/)

<DocsFooter />
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.

Do we need <DocsFooter /> here? I'm seeing an extra, empty API section and I'm wondering if this component might be the reason why.

Image

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.

ahh i just need to move the API header in to the conditional render so if its not a component footer then the table is left out.


<Meta of={ConversationThreadStories} />

<DocsHeader />
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.

I wonder if a follow-up ticket to refine these conv AI stories would be helpful here - now that we're using mdx, we have a bit more freedom in the way these components get documented, is there anything we would want to change?

Maybe it's not necessary though? Just a thought, maybe @aramos-adobe has thoughts here.

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.

yes i totally 100% agree with this, this feels like its own initiative and touches on the team sync convo we need to have about "what are patterns and how do we approach them structuraly"

export const Playground: Story = {
render: renderThread,
tags: ['autodocs', 'dev'],
tags: ['dev'],
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.

We weren't supposed to have autodocs tagged on Playground stories, right? So we've trimmed that story from all the docs pages for Conv AI?

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.

Correct, the autodocs tag will trigger Storybook's internal mechanism that will use DocumentTemplate over the MDX, so we remove this so MDX wins. dev will make sure it's exposed in the sidebar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. Component:Documentation Issues or PRs involving changes to docs or docs website. Component prefix is for Jira integration. High priority PR review PR is a high priority and should be reviewed ASAP Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants