Skip to content

Conversation

@castastrophe
Copy link
Collaborator

@castastrophe castastrophe commented Oct 22, 2025

Description

This update removes --mod-badge-* custom property hooks per SWC-1264, see also the RFC for extensible styling. Class selectors and variants remain unchanged; stories were refreshed to match the current API.

  • Remove all --mod-badge-* custom property hooks.
  • Reduces unnecessary re-mapping of custom properties in favor of using them directly

Breaking change: the --mod-badge-* override layer is removed. Consumers should set --spectrum-badge-* variables directly where customization as needed.

Related issue(s)

  • fixes SWC-1264

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes (or confirmed existing coverage is sufficient for styling-only 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 passing or approved

Validation steps

  • No visual or behavioral changes compared to the current spectrum-two baseline.

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:

    • The pages render correctly, are accessible, and are responsive.
  2. If components have been modified, VRTs have been run on this branch:

    • VRTs have been run and looked at.
    • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2025

⚠️ No Changeset found

Latest commit: 8237249

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 changesets to release 10 packages
Name Type
@spectrum-css/alertdialog Major
@spectrum-css/asset Major
@spectrum-css/assetcard Major
@spectrum-css/assetlist Major
@spectrum-css/avatar Major
@spectrum-css/badge Major
@spectrum-css/miller Major
@spectrum-css/well Major
@spectrum-css/bundle Patch
@spectrum-css/preview Patch

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

@castastrophe castastrophe changed the base branch from main to spectrum-two October 22, 2025 18:47
@castastrophe castastrophe marked this pull request as ready for review October 22, 2025 18:47
@castastrophe castastrophe self-assigned this Oct 22, 2025
@castastrophe castastrophe added size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete. run_vrt For use on PRs looking to kick off VRT S2 Spectrum 2 ready-for-review labels Oct 22, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

📚 Branch preview

PR #4283 has been deployed to Azure Blob Storage: https://spectrumcss.z13.web.core.windows.net/pr-4283/index.html.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

File metrics

Summary

Total size: 1.41 MB*

Package Size Minified Gzipped
badge 13.66 KB 12.95 KB 1.73 KB

badge

Filename Head Minified Gzipped Compared to base
index.css 13.66 KB 12.95 KB 1.73 KB 🟢 ⬇ 9.31 KB
metadata.json 9.72 KB - - 🟢 ⬇ 5.78 KB
* Size is the sum of all main files for packages in the library.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

@castastrophe castastrophe force-pushed the castastrophe/feat-badge-modifier-removal branch from 867caf9 to bf4974a Compare October 22, 2025 19:11
@castastrophe castastrophe force-pushed the castastrophe/feat-badge-modifier-removal branch from bf4974a to 8237249 Compare October 22, 2025 19:47
".spectrum-Badge--turquoise",
".spectrum-Badge--yellow",
".spectrum-Badge--subtle",
".spectrum-Badge--subtle:where(.spectrum-Badge--accent)",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI in the SWC next-gen web component we updated this class to remove the -style from the class name.

Copy link
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.

Looks good! Left some questions for building my own knowledge on this work.

---

This update removes `--mod-*` custom property hooks per SWC-1264, see also the RFC for extensible styling.
This update removes `--mod-*` custom property hooks per SWC-1264, see also the RFC for extensible styling. In addition, this update cleans up any component-level custom properties that did not rely on the CSS cascade to define the styles; this was done to reduce the number of custom properties that are defined at the component level and trim down the size of the CSS we are shipping to consumers.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love this update! ❤️

/* background color variants */
&.spectrum-Badge--neutral {
background: var(--mod-badge-subtle-background-color-default, var(--spectrum-badge-subtle-background-color-default));
&:where(.spectrum-Badge--neutral) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tell me more about :where() in this context, it seems like the benefit over trying to match both classes is that it doesn't add specificity, right? I'm especially curious as we carry out similar CSS updates in other components. Will we want to consider this pattern in similar use cases in other components? Any pitfalls to be aware of? Any other things to note? (I believe it was :where in another component in that action menu PR I reviewed where we discovered that we actually did want the added specificity, for instance.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, great questions. Badge is a good use-case for :where in that there are only a few variants active at any given time. I kept specificity on outline and subtle but where the colors showed up, I let the order they show up in the file be the deciding factor. For more complex components this gets ultra tricky because there are cases where we want that specificity. This seemed like a great opportunity to reduce it though so I added it here.

/* Style = subtle */
.spectrum-Badge--style-subtle {
color: var(--mod-badge-subtle-label-icon-color, var(--spectrum-badge-subtle-label-icon-color));
.spectrum-Badge--subtle {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm on board with this change (and I see it's in barebones already 🎉 ), and given that our changeset will reflect alll the other component changes, I think I can see the rationale for not documenting this change in the changeset and I'm on board with that too... but I still want to highlight it for consideration in case someone else has a strong opinion or we have second thoughts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I did check our changesets to see if there were any references to the new class name and since it wasn't there, I opted to leave it out of the new docs. The concept of what was added is in the previous changeset but not the class name specifically.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there any plans to carry over these changes to barebones? I'm assuming we'd want this version of the CSS to land in SWC at some point.

@castastrophe castastrophe merged commit f224547 into spectrum-two Oct 22, 2025
14 of 15 checks passed
@castastrophe castastrophe deleted the castastrophe/feat-badge-modifier-removal branch October 22, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review run_vrt For use on PRs looking to kick off VRT S2 Spectrum 2 size-2 S ~6-18hrs; not hard or time consuming, one or two work days to complete.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants