Skip to content

Conversation

castastrophe
Copy link
Contributor

@castastrophe castastrophe commented Sep 17, 2025

Description

This PR adds essential Storybook plugins to the second-generation Spectrum Web Components package to enhance the development and documentation experience. The changes include adding three key Storybook addons: docs, accessibility (a11y), and designs, along with configuration updates to enable auto-documentation and centered layout.

Motivation and context

The second-generation SWC package was missing essential Storybook plugins that are crucial for:

  • Documentation: Auto-generated docs from component stories
  • Accessibility: Built-in a11y testing and reporting
  • Design integration: Support for design system integration and Figma links

These plugins are standard in modern component development workflows and will improve the developer experience for contributors working on the second-generation components.

Related issue(s)

  • SWC-1245

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

  • Storybook addons functionality

    1. Go to second-gen/packages/swc/ directory
    2. Run yarn storybook to start the Storybook development server
    3. Expect to see Docs, Accessibility, and Design tabs in the Storybook interface
  • Auto-documentation generation

    1. Navigate to any component story in Storybook
    2. Check the Docs tab
    3. Expect to see auto-generated documentation with component props and examples
  • Accessibility testing

    1. Open any component story in Storybook
    2. Navigate to the Accessibility tab
    3. Expect to see accessibility violations and recommendations

Copy link

changeset-bot bot commented Sep 17, 2025

⚠️ No Changeset found

Latest commit: d7025fb

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

import '../tokens/medium-vars.css';
import '../tokens/global-vars.css';

import { html } from 'lit';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This wasn't actually being used in this file so the import wasn't needed.


const preview = {
parameters: {
layout: 'centered',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think centered or padded are nice customer experiences. The downside of making every component fullscreen is that the smaller components get squashed into the top left corner.

},
},
},
tags: ['autodocs'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Automatically triggers documentation pages for every component. Components can opt-out using tags: ['!autodocs']

Copy link
Contributor

github-actions bot commented Sep 17, 2025

📚 Branch Preview

🔍 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-5737

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.

"@axe-core/playwright": "^4.10.2",
"@custom-elements-manifest/analyzer": "^0.10.5",
"@storybook/addon-a11y": "9.1.3",
"@storybook/addon-designs": "10.0.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This lets us bring over the Figma resources that we have linked in CSS.

Copy link
Contributor

Tachometer results

Currently, no packages are changed by this PR...

@castastrophe castastrophe force-pushed the castastrophe/feat-add-s2-storybook-plugins branch from ee03381 to d7025fb Compare September 19, 2025 14:47
@castastrophe castastrophe self-assigned this Sep 19, 2025
@castastrophe castastrophe marked this pull request as ready for review September 19, 2025 15:02
@castastrophe castastrophe requested a review from a team as a code owner September 19, 2025 15:02
@rubencarvalho rubencarvalho merged commit dc74fb2 into barebones Sep 19, 2025
7 of 21 checks passed
@rubencarvalho rubencarvalho deleted the castastrophe/feat-add-s2-storybook-plugins branch September 19, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants