From 677bf184bb5c364c2b8eb4684493d9ad0ad20efa Mon Sep 17 00:00:00 2001 From: Tarun Tomar Date: Tue, 19 May 2026 16:45:13 +0530 Subject: [PATCH 1/2] chore(close-button): migration guide --- 2nd-gen/packages/swc/.storybook/preview.ts | 13 +- .../close-button/migration-guide.mdx | 160 ++++++++++++++++++ 2 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 2nd-gen/packages/swc/components/close-button/migration-guide.mdx diff --git a/2nd-gen/packages/swc/.storybook/preview.ts b/2nd-gen/packages/swc/.storybook/preview.ts index 73e4673e0a..37e79dcd67 100644 --- a/2nd-gen/packages/swc/.storybook/preview.ts +++ b/2nd-gen/packages/swc/.storybook/preview.ts @@ -330,7 +330,10 @@ const preview = { 'Rendering and styling migration analysis', ], 'Action button', - ['Rendering and styling migration analysis'], + [ + 'Accessibility migration analysis', + 'Rendering and styling migration analysis', + ], 'Action group', ['Rendering and styling migration analysis'], 'Action menu', @@ -360,9 +363,14 @@ const preview = { 'Rendering and styling migration analysis', ], 'Button group', - ['Rendering and styling migration analysis'], + [ + 'Accessibility migration analysis', + 'Rendering and styling migration analysis', + ], 'Checkbox', ['Rendering and styling migration analysis'], + 'Close button', + ['Accessibility migration analysis'], 'Color field', ['Rendering and styling migration analysis'], 'Color loupe', @@ -397,6 +405,7 @@ const preview = { 'Link', [ 'Accessibility migration analysis', + 'Migration plan', 'Rendering and styling migration analysis', ], 'Menu', diff --git a/2nd-gen/packages/swc/components/close-button/migration-guide.mdx b/2nd-gen/packages/swc/components/close-button/migration-guide.mdx new file mode 100644 index 0000000000..18a2344e0e --- /dev/null +++ b/2nd-gen/packages/swc/components/close-button/migration-guide.mdx @@ -0,0 +1,160 @@ +import { Meta } from '@storybook/addon-docs/blocks'; + + + +# Close button migration guide + +Replace `` with ``, update the import, and rename `label` to `accessible-label`. + +## What changed + +### Renamed + +| Area | Spectrum 1 (`sp-close-button`) | Spectrum 2 (`swc-close-button`) | +| ---------------- | ---------------------------------------------------- | ---------------------------------------------------------------- | +| Tag | `sp-close-button` | `swc-close-button` | +| Import path | `@spectrum-web-components/button/sp-close-button.js` | `@adobe/spectrum-wc/components/close-button/swc-close-button.js` | +| Accessible name | `label="..."` | `accessible-label="..."` | +| CSS custom props | `--mod-closebutton-*` | `--swc-close-button-*` (see [Styling](#styling)) | + +### Added in Spectrum 2 + +| Addition | Notes | +| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `icon-size` attribute | `regular` (default) or `large`. Spectrum 1 used the large cross scale; set `icon-size="large"` to match. See [step 4](#4-optional-set-icon-size-large). | + +### Removed in Spectrum 2 + +| Removed | Replacement | +| --------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `variant="white"` / `variant="black"` | `static-color="white"` / `static-color="black"` (see [step 3](#3-replace-variant-with-static-color)) | +| `label` attribute | `accessible-label` instead | +| `--mod-closebutton-*` custom properties | `--swc-close-button-*` equivalents (see [Styling](#styling)) | + +## Update your code + +### 1. Update the import + +```js +// Before +import '@spectrum-web-components/button/sp-close-button.js'; +// After +import '@adobe/spectrum-wc/components/close-button/swc-close-button.js'; +``` + +### 2. Rename the tag and `label` attribute + +```html + + +Close + + +Close +``` + +`size`, `disabled`, `static-color`, and `autofocus` are unchanged. + +### 3. Replace `variant` with `static-color` + +```html + + + + + + +``` + +### 4. (Optional) Set `icon-size="large"` + +```html + + + + +``` + +## Accessibility + +- **Accessible name is required.** Use `accessible-label` or default-slot text. See [step 2](#2-rename-the-tag-and-label-attribute). +- **Match the action to the label.** Use **Close** or **Dismiss** for dismiss controls, not **Clear selection** (`` clears field values). +- **Do not use `` for general actions.** Use `` instead. + +## Styling + +Spectrum 2 exposes a new set of public CSS custom properties on ``. + +{/* @todo Replace the inline-styled callouts in this section with `` once it is migrated to Spectrum 2. */} + +
+ โš ๏ธ Breaking change. Spectrum 1{' '} + {'--mod-closebutton-*'} properties do not apply{' '} + to {''}. Remove or replace every{' '} + {'--mod-closebutton-*'} override with the{' '} + {'--swc-close-button-*'} equivalents below. Not every Spectrum 1 + property has a 1:1 replacement, so read the list below carefully. +
+ +Public custom properties: + +{/* @todo Replace the Description column with the `@cssproperty` JSDoc descriptions from ``'s CEM entry once they are added in a follow-up PR. */} + +| Custom property | Description | +| ---------------------------------------------- | ------------------------------------------------ | +| `--swc-close-button-size` | Inline and block size of the control. | +| `--swc-close-button-border-radius` | Corner radius of the hit target. | +| `--swc-close-button-icon-color-default` | Cross color in the default state. | +| `--swc-close-button-icon-color-hover` | Cross color on hover. | +| `--swc-close-button-icon-color-focus` | Cross color when focused. | +| `--swc-close-button-icon-color-down` | Cross color when pressed. | +| `--swc-close-button-icon-color-disabled` | Cross color when disabled. | +| `--swc-close-button-focus-indicator-gap` | Gap between the control edge and the focus ring. | +| `--swc-close-button-focus-indicator-thickness` | Thickness of the focus ring. | +| `--swc-close-button-focus-indicator-color` | Color of the focus ring. | +| `--swc-close-button-background-color-default` | Background in the default state. | +| `--swc-close-button-background-color-hover` | Background on hover. | +| `--swc-close-button-background-color-focus` | Background when focused. | +| `--swc-close-button-background-color-down` | Background when pressed. | + +
+ ๐Ÿšซ Do not target internals. Internal classes,{' '} + {'--_swc-close-button-*'} private properties, and shadow DOM are{' '} + not public API. Styling applied to them will break without + warning on minor releases. +
+ +## Checklist + +- [ ] Update imports from `@spectrum-web-components/button/sp-close-button.js` to `@adobe/spectrum-wc/components/close-button/swc-close-button.js` +- [ ] Rename all `` to `` +- [ ] Rename `label` to `accessible-label` +- [ ] Replace `variant="white"` / `variant="black"` with `static-color` +- [ ] Set `icon-size="large"` if you need Spectrum 1 cross icon scale +- [ ] Replace `--mod-closebutton-*` CSS overrides with `--swc-close-button-*` equivalents From f9b9450adce6b9c5bf23a84d6f350cbe01aac53d Mon Sep 17 00:00:00 2001 From: Tarun Tomar Date: Wed, 20 May 2026 17:04:11 +0530 Subject: [PATCH 2/2] docs(close-button): replace consumer guide with migration planning docs --- .../close-button/migration-guide.mdx | 160 ---------- .../03_components/README.md | 2 + .../close-button/migration-plan.md | 281 ++++++++++++++++++ ...endering-and-styling-migration-analysis.md | 107 +++++++ 4 files changed, 390 insertions(+), 160 deletions(-) delete mode 100644 2nd-gen/packages/swc/components/close-button/migration-guide.mdx create mode 100644 CONTRIBUTOR-DOCS/03_project-planning/03_components/close-button/migration-plan.md create mode 100644 CONTRIBUTOR-DOCS/03_project-planning/03_components/close-button/rendering-and-styling-migration-analysis.md diff --git a/2nd-gen/packages/swc/components/close-button/migration-guide.mdx b/2nd-gen/packages/swc/components/close-button/migration-guide.mdx deleted file mode 100644 index 18a2344e0e..0000000000 --- a/2nd-gen/packages/swc/components/close-button/migration-guide.mdx +++ /dev/null @@ -1,160 +0,0 @@ -import { Meta } from '@storybook/addon-docs/blocks'; - - - -# Close button migration guide - -Replace `` with ``, update the import, and rename `label` to `accessible-label`. - -## What changed - -### Renamed - -| Area | Spectrum 1 (`sp-close-button`) | Spectrum 2 (`swc-close-button`) | -| ---------------- | ---------------------------------------------------- | ---------------------------------------------------------------- | -| Tag | `sp-close-button` | `swc-close-button` | -| Import path | `@spectrum-web-components/button/sp-close-button.js` | `@adobe/spectrum-wc/components/close-button/swc-close-button.js` | -| Accessible name | `label="..."` | `accessible-label="..."` | -| CSS custom props | `--mod-closebutton-*` | `--swc-close-button-*` (see [Styling](#styling)) | - -### Added in Spectrum 2 - -| Addition | Notes | -| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `icon-size` attribute | `regular` (default) or `large`. Spectrum 1 used the large cross scale; set `icon-size="large"` to match. See [step 4](#4-optional-set-icon-size-large). | - -### Removed in Spectrum 2 - -| Removed | Replacement | -| --------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `variant="white"` / `variant="black"` | `static-color="white"` / `static-color="black"` (see [step 3](#3-replace-variant-with-static-color)) | -| `label` attribute | `accessible-label` instead | -| `--mod-closebutton-*` custom properties | `--swc-close-button-*` equivalents (see [Styling](#styling)) | - -## Update your code - -### 1. Update the import - -```js -// Before -import '@spectrum-web-components/button/sp-close-button.js'; -// After -import '@adobe/spectrum-wc/components/close-button/swc-close-button.js'; -``` - -### 2. Rename the tag and `label` attribute - -```html - - -Close - - -Close -``` - -`size`, `disabled`, `static-color`, and `autofocus` are unchanged. - -### 3. Replace `variant` with `static-color` - -```html - - - - - - -``` - -### 4. (Optional) Set `icon-size="large"` - -```html - - - - -``` - -## Accessibility - -- **Accessible name is required.** Use `accessible-label` or default-slot text. See [step 2](#2-rename-the-tag-and-label-attribute). -- **Match the action to the label.** Use **Close** or **Dismiss** for dismiss controls, not **Clear selection** (`` clears field values). -- **Do not use `` for general actions.** Use `` instead. - -## Styling - -Spectrum 2 exposes a new set of public CSS custom properties on ``. - -{/* @todo Replace the inline-styled callouts in this section with `` once it is migrated to Spectrum 2. */} - -
- โš ๏ธ Breaking change. Spectrum 1{' '} - {'--mod-closebutton-*'} properties do not apply{' '} - to {''}. Remove or replace every{' '} - {'--mod-closebutton-*'} override with the{' '} - {'--swc-close-button-*'} equivalents below. Not every Spectrum 1 - property has a 1:1 replacement, so read the list below carefully. -
- -Public custom properties: - -{/* @todo Replace the Description column with the `@cssproperty` JSDoc descriptions from ``'s CEM entry once they are added in a follow-up PR. */} - -| Custom property | Description | -| ---------------------------------------------- | ------------------------------------------------ | -| `--swc-close-button-size` | Inline and block size of the control. | -| `--swc-close-button-border-radius` | Corner radius of the hit target. | -| `--swc-close-button-icon-color-default` | Cross color in the default state. | -| `--swc-close-button-icon-color-hover` | Cross color on hover. | -| `--swc-close-button-icon-color-focus` | Cross color when focused. | -| `--swc-close-button-icon-color-down` | Cross color when pressed. | -| `--swc-close-button-icon-color-disabled` | Cross color when disabled. | -| `--swc-close-button-focus-indicator-gap` | Gap between the control edge and the focus ring. | -| `--swc-close-button-focus-indicator-thickness` | Thickness of the focus ring. | -| `--swc-close-button-focus-indicator-color` | Color of the focus ring. | -| `--swc-close-button-background-color-default` | Background in the default state. | -| `--swc-close-button-background-color-hover` | Background on hover. | -| `--swc-close-button-background-color-focus` | Background when focused. | -| `--swc-close-button-background-color-down` | Background when pressed. | - -
- ๐Ÿšซ Do not target internals. Internal classes,{' '} - {'--_swc-close-button-*'} private properties, and shadow DOM are{' '} - not public API. Styling applied to them will break without - warning on minor releases. -
- -## Checklist - -- [ ] Update imports from `@spectrum-web-components/button/sp-close-button.js` to `@adobe/spectrum-wc/components/close-button/swc-close-button.js` -- [ ] Rename all `` to `` -- [ ] Rename `label` to `accessible-label` -- [ ] Replace `variant="white"` / `variant="black"` with `static-color` -- [ ] Set `icon-size="large"` if you need Spectrum 1 cross icon scale -- [ ] Replace `--mod-closebutton-*` CSS overrides with `--swc-close-button-*` equivalents diff --git a/CONTRIBUTOR-DOCS/03_project-planning/03_components/README.md b/CONTRIBUTOR-DOCS/03_project-planning/03_components/README.md index b95254558c..035e3ef2a5 100644 --- a/CONTRIBUTOR-DOCS/03_project-planning/03_components/README.md +++ b/CONTRIBUTOR-DOCS/03_project-planning/03_components/README.md @@ -52,6 +52,8 @@ - [Checkbox migration roadmap](checkbox/rendering-and-styling-migration-analysis.md) - Close Button - [Close button accessibility migration analysis](close-button/accessibility-migration-analysis.md) + - [Close button migration plan](close-button/migration-plan.md) + - [Close button migration roadmap](close-button/rendering-and-styling-migration-analysis.md) - Color Field - [Color field migration roadmap](color-field/rendering-and-styling-migration-analysis.md) - Color Loupe diff --git a/CONTRIBUTOR-DOCS/03_project-planning/03_components/close-button/migration-plan.md b/CONTRIBUTOR-DOCS/03_project-planning/03_components/close-button/migration-plan.md new file mode 100644 index 0000000000..e88a596b33 --- /dev/null +++ b/CONTRIBUTOR-DOCS/03_project-planning/03_components/close-button/migration-plan.md @@ -0,0 +1,281 @@ + + +[CONTRIBUTOR-DOCS](../../../README.md) / [Project planning](../../README.md) / [Components](../README.md) / Close Button / Close button migration plan + + + +# Close button migration plan + + + +
+In this doc + +- [TL;DR](#tldr) + - [Most blocking open questions](#most-blocking-open-questions) +- [1st-gen API surface](#1st-gen-api-surface) + - [Properties / attributes](#properties--attributes) + - [Methods](#methods) + - [Events](#events) + - [Slots](#slots) + - [CSS custom properties](#css-custom-properties) + - [Shadow DOM output (rendered HTML)](#shadow-dom-output-rendered-html) +- [Dependencies](#dependencies) +- [Migration sequencing and prerequisites](#migration-sequencing-and-prerequisites) +- [Changes overview](#changes-overview) + - [Must ship โ€” breaking or a11y-required](#must-ship--breaking-or-a11y-required) + - [Additive โ€” ships when ready, zero breakage for consumers already on 2nd-gen](#additive--ships-when-ready-zero-breakage-for-consumers-already-on-2nd-gen) +- [2nd-gen API decisions](#2nd-gen-api-decisions) + - [Public API](#public-api) + - [Behavioral semantics](#behavioral-semantics) + - [Accessibility semantics notes (2nd-gen)](#accessibility-semantics-notes-2nd-gen) +- [Architecture: core vs SWC split](#architecture-core-vs-swc-split) +- [Migration checklist](#migration-checklist) + - [Preparation (this ticket)](#preparation-this-ticket) + - [Setup](#setup) + - [API](#api) + - [Styling](#styling) + - [Accessibility](#accessibility) + - [Testing](#testing) + - [Documentation](#documentation) + - [Review](#review) +- [Blockers and open questions](#blockers-and-open-questions) + - [Design](#design) + - [Architecture and behavior](#architecture-and-behavior) + - [Scope and prerequisites](#scope-and-prerequisites) +- [References](#references) + +
+ + + +> **Epic SWC-2087** ยท Planning output. Must be reviewed before implementation begins. + +--- + +## TL;DR + +- `swc-close-button` should ship as a dedicated 2nd-gen component in both `core` and `swc` layers, not as an extension point buried inside `swc-button`. +- API should align with modern button conventions: `accessible-label` (consumer-facing), `static-color`, and `size` (`s|m|l|xl`). +- Variant aliases from 1st-gen (`variant="white|black"`) should be deprecated in favor of `static-color`. +- Styling source of truth is Spectrum CSS `spectrum-two` `components/closebutton`; 2nd-gen should not re-expose the 1st-gen `--mod-closebutton-*` surface. +- Accessibility is must-ship: real inner `