feat(action-button): S2 migration#6340
Conversation
🦋 Changeset detectedLatest commit: b22d71b The changes in this PR will be included in the next version bump. This PR includes changesets to release 85 packages
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 |
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen 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: If the changes are expected, update the |
b028dc5 to
bfb1116
Compare
7b9a44d to
d04c7f8
Compare
26245eb to
e5dfef0
Compare
| public get emphasized(): boolean { | ||
| return this._emphasized; | ||
| } | ||
| public set emphasized(value: boolean) { | ||
| const oldValue = this._emphasized; | ||
| this._emphasized = value; | ||
| this.requestUpdate('emphasized', oldValue); | ||
| if (value && window.__swc?.DEBUG) { | ||
| window.__swc.warn( | ||
| this, | ||
| `The "emphasized" attribute on <${this.localName}> is deprecated and will be removed in a future release.`, | ||
| 'https://opensource.adobe.com/spectrum-web-components/components/action-button/', | ||
| { level: 'deprecation' } | ||
| ); | ||
| } | ||
| } | ||
| private _emphasized = false; |
There was a problem hiding this comment.
why arent we just added a warning to the updated() lifecycle and listening for scheduledChanges? I can find another component to pattern off of.
There was a problem hiding this comment.
I'm not sure what scheduledChanges is? I can refactor it though if you've got an example. ✨
There was a problem hiding this comment.
can we add transitions in and out so its not a flash?
There was a problem hiding this comment.
Should we do this as part of the change to a directive? We'd have to refactor from a display based approach to one using visibility or opacity. ✨ @5t3ph
There was a problem hiding this comment.
React is currently not using any transition, so maybe defer. There would be a bit of orchestration to get this to happen smoothly with swapping the label (and/or icon) with the spinner.
There was a problem hiding this comment.
It's a Storybook template issue - see comment there
| /** | ||
| * Static color treatment for display over colored or image backgrounds. | ||
| */ | ||
| @property({ type: String, reflect: true, attribute: 'static-color' }) | ||
| public staticColor?: ActionButtonStaticColor; |
There was a problem hiding this comment.
I called this out in the close button but maybe we need to add a todo here if you dont mind but staticColor should be on buttonBase because all button types that ive seen include it. but the solution might also be a staticColorMixin because its not just button that use static color as well
There was a problem hiding this comment.
I would suggest pause on a change here and wait for close button to merge. We could further re-evaluate/refine later if that's ok @caseyisonit?
| const validSize = ( | ||
| validSizes.includes(size) ? size : fallbackSize | ||
| classValidSizes.includes(size) ? size : fallbackSize | ||
| ) as ElementSize; |
There was a problem hiding this comment.
Can you explain this change and why its needed? sorry if you answered this on another PR
There was a problem hiding this comment.
cant we just call VALID_SIZES do we need to call it from the constructor since this method is in the same constructor? we also override VALID_SIZES in all components pretty much. trying to wrap my head around so apologies if this is long winded.
There was a problem hiding this comment.
Ah! @rise-erpelding caught this on the API/TS branch too #6346 (comment) ✨
There was a problem hiding this comment.
can everything @internal use _ prepended to the name
There was a problem hiding this comment.
The @internal methods in the action button are all overrides (VALID_SIZES, observedAttributes and attributeChangedCallback) so we can't prefix those and the others have the _ prefix. Or are there others we're missing? ✨
| // Guard against re-entrant attributeChangedCallback: removeAttribute fires a | ||
| // second callback with value=null; the guard prevents that from clearing the | ||
| // state we just set. | ||
| private _ariaForwardingInProgress = false; |
There was a problem hiding this comment.
It shouldn't, since _ariaForwardingInProgress is set to true and back to false in the same synchronous call and doesn't persist between renders or have rendered output. ✨
5t3ph
left a comment
There was a problem hiding this comment.
Just a couple docs things!
There was a problem hiding this comment.
It's a Storybook template issue - see comment there
30c08d7 to
38eef33
Compare
…ponent (#6327) * feat(action-button): adds migration plan for the S2 action button component * chore(action-button): address feedback * chore(action-button): address feedback
* chore(action-button): adds structure for s2 migration * chore: clean up base class and export types * chore(action-button): update migration plan * chore(action-button): address feedback
* chore(action-button): migrate api and typescript code * chore(action-button): update migration plan * chore(action-button): api/ts self review * chore(action-button): address feedback * chore(action-button): address feedback
* chore(action-button): styling implementation * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): fix bug w/lit and icon only variant * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): address feedback * Update 2nd-gen/packages/swc/.storybook/guides/customization/global-elements.mdx Co-authored-by: Stephanie Eckles <seckles@adobe.com> * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): style guide conformance * chore(action-button): address feedback * chore(action-button): test suites * chore(action-button): add a11y keyboard tests
* chore(action-button): implement accessibility features (#6348) * chore(action-button): implement accessibility features * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): styling implementation * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): fix bug w/lit and icon only variant * chore(action-button): address feedback * chore(action-button): address feedback * Update 2nd-gen/packages/swc/.storybook/guides/customization/global-elements.mdx Co-authored-by: Stephanie Eckles <seckles@adobe.com> * chore(action-button): style guide conformance (#6364) * chore(action-button): styling implementation * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): address feedback * Update 2nd-gen/packages/swc/.storybook/guides/customization/global-elements.mdx Co-authored-by: Stephanie Eckles <seckles@adobe.com> * chore(action-button): address feedback --------- Co-authored-by: Stephanie Eckles <seckles@adobe.com>
* chore(action-button): implement accessibility features (#6348) * chore(action-button): implement accessibility features * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): styling implementation * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): fix bug w/lit and icon only variant * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): style guide conformance (#6364) * chore(action-button): styling implementation * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): storybook docs * chore(action-button): address feedback * Update 2nd-gen/packages/swc/components/action-button/action-button.mdx Co-authored-by: Casey Eickhoff <48574582+caseyisonit@users.noreply.github.com> * chore(action-button): address feedback * chore(action-button): address feedback * chore(action-button): fix test failure * chore(action-button): fix test failure * chore(action-button): author consumer migration guide (#6408) * chore(action-button): author consumer migration guide * chore(action-button): update migration plan --------- Co-authored-by: Casey Eickhoff <48574582+caseyisonit@users.noreply.github.com>
…ration warnings w/component
…a space in icon only examples
Co-authored-by: Stephanie Eckles <seckles@adobe.com>
…utton.stories.ts Co-authored-by: Stephanie Eckles <seckles@adobe.com>
fc48da9 to
b22d71b
Compare
|
Reminder to add the |

Description
Umbrella PR for the
swc-action-button1st-gen → 2nd-gen Spectrum 2 migration. All phase PRs target this branch and are merged here before this PR lands onmain.Migration plan:
CONTRIBUTOR-DOCS/03_project-planning/03_components/action-button/migration-plan.md(merged in #6327)Phase PRs
Motivation and context
swc-action-buttonis part of the Spectrum 2 component migration workstream. Key changes from 1st-gen:<button>as the semantic control (host no longer carriesrole="button")toggles,selected,emphasized— toggle UX moves toswc-toggle-button/swc-toggle-button-grouphold-affordance/longpresshrefand related attributes)accessible-labelreplaceslabel;aria-haspopup/aria-expandedare forwarded to the inner<button>for menu-trigger patternspendingstate (new in 2nd-gen, matchingswc-button)--swc-action-button-*custom properties instead of the 1st-gen--mod-*/--spectrum-actionbutton-*chainRelated issue(s)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Default render and slot content
accessible-label), and icon + label variants all render correctlyquietvariant renders without a visible border at reststatic-color="white"andstatic-color="black"render with the correct foreground colorAll sizes render correctly
xs,s,m,l, andxlall render at the expected visual scalexsis present (it is not available onswc-button)Disabled state
clickevent and no activationPending state (after 1-second delay)
Breaking changes behave as documented in the consumer migration guide
toggles,selected,emphasized,href,hold-affordance, andlabelare absent from the 2nd-gen APIswc-toggle-button/swc-toggle-button-groupfor toggle usageDevice review
Accessibility testing checklist
Keyboard (required — document steps below)
<button>, not the hostaccessible-labelvalue + ", button"Screen reader (required — document steps below)
swc-action-buttonelement is NOT announced as a separate button (semantics live on the inner<button>)aria-haspopup— expect: "button, has popup" announcement