feat(infield-button): migrate CSS and stories for Phase 5 (styling) - #6499
Conversation
|
📚 Branch Preview Links🔍 Gen1 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 |
5t3ph
left a comment
There was a problem hiding this comment.
Refactor needed - let me know if you want assistance converting this!
5t3ph
left a comment
There was a problem hiding this comment.
More refactor steps are needed to bring this up to S2 expectations, following the example of S2 Number Field.
nikkimk
left a comment
There was a problem hiding this comment.
Since an infield button is only ever used in a field and not as a standalone component, the examples should show it used inside fields accessibly. This allows us to fully test for accessibility as well as model to our consumers how to use this component.
5t3ph
left a comment
There was a problem hiding this comment.
The padding and icon size related adjustments look good!
Some remaining cleanup of custom property use.
27a9133 to
b4b9692
Compare
7961190 to
a77804c
Compare
… treatment Migrates infield-button CSS to 2nd-gen structure with Spectrum 2 tokens. Removes decorative border (gray-100 background provides visual separation); keeps forced-colors border for accessibility. Quiet variant sets background-color:transparent only. Press transform uses perspective() with a valid <length> derived from padding and icon-size. Stories and MDX authored. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Use private --_swc-infield-button-padding and --_swc-infield-button-icon-size to eliminate duplication in the block-size calc and padding declarations - Remove the five exposed border-radius custom properties; corner radius is now a direct token() call managed by the consuming field - Move quiet treatment to host-level custom property overrides matching the action-button pattern; add --swc-infield-button-background-color-disabled so disabled+quiet composes correctly - Change slotted icon selector to ::slotted([slot="icon"]) - Reduce forced-colors block to base and disabled rules only; remove the hover/active/focus-visible block and add an explicit border for visibility - Update @cssprop tags to match Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…om InfieldButtonBase ButtonBase does not declare pending or pendingLabel, so the @State() override modifiers were causing TS4113 errors. Infield buttons intentionally have no pending state — the parent field host owns busy UI and disables slotted buttons while pending. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The browser's native <button> element already maps colors correctly in forced-colors mode without an explicit override. Re-mapping ButtonText/ButtonFace/ButtonBorder is what the browser does automatically, and forced-color-adjust: none opts out of that behavior unnecessarily. Other components (action-button, button) only add forced-colors rules for things the browser cannot infer automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The base style sets border: none, which removes the button's visual boundary in forced-colors mode. Add back just `border: 1px solid` so the UA maps it to ButtonBorder automatically — no color override needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9f5d5c8 to
0856170
Compare
5t3ph
left a comment
There was a problem hiding this comment.
Thanks for working through this!
nikkimk
left a comment
There was a problem hiding this comment.
Since an infield button is only ever used in a field and not as a standalone component, the examples should show it used inside fields accessibly. This allows us to fully test for accessibility as well as model to our consumers how to use this component.
Agreed but this depends on
swc-pickerandswc-numberfieldbeing visually ready. If I add a contrived wrapper that would misrepresent actual usage. I'd like to track this as a follow-up once those components are available. For now, the component's own accessibility contract is narrow by design:accessible-labelmaps toaria-labelon the inner<button>, and tabindex="-1" keeps it out of the tab order. I've verified that contract is wired correctly.![]()
The stories should use a dummy component in these examples to use an existing one anyway, because that shows the users how to implement it accessibly in their own code. See how the FocusgroupNavigationController and LiveSelectionController docs use stories that are not actual SWC components.
I won't be able to sign off without testing these in context.
Per review feedback: infield buttons are only ever used inside a form field, so examples should model that real-world pattern accessibly. - Overview: picker field (Country text input + chevron button) - Anatomy: three field types (picker, search/clear, number stepper) - Accessibility: same three field types for accurate a11y tree coverage Field wrappers use a native <label>/<input> pair so axe and ARIA snapshot tests can verify label association alongside button labels. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
91a253a to
2b1bb29
Compare
… 2 Figma Extract a single renderField() template function shared by all three field context helpers (picker, search, stepper). Wrapper uses padding:6px, stretch alignment, and Spectrum token-based border/radius. Stepper places both buttons on the trailing edge to match the Figma spec. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nikkimk Make sense. I added some demo components to replicate the UI composition of this component. Let me know if this is fine or not. |
nikkimk
left a comment
There was a problem hiding this comment.
Thanks for taking this on. LTGM


Description
Phase 5 (styling) of the 1st-gen → 2nd-gen
swc-infield-buttonmigration, updated to address review feedback.CSS (
infield-button.css)padding: var(--swc-infield-button-padding, token("accessory-item-padding-medium"))plus icon. Consuming fields control outer dimensions and spacing.:host([size="*"])set public custom properties that cascade into the button:--swc-infield-button-padding→accessory-item-padding-small(3px)--swc-infield-button-padding→accessory-item-padding-large(7px);--swc-infield-button-icon-size→workflow-icon-2x-small(12px)--swc-infield-button-padding→accessory-item-padding-extra-large(9px);--swc-infield-button-icon-size→workflow-icon-extra-small(14px)workflow-icon-3x-small(10px, default), L →workflow-icon-2x-small(12px), XL →workflow-icon-extra-small(14px). Icon size is resolved inside the::slotted()rule, following thebutton.csspattern.--swc-infield-button-down-state-transform.border-*-radiuscustom properties so parent fields can zero out inner corners without losing the outer radius.Stories (
stories/infield-button.stories.ts)All stories show
swc-infield-buttoninside a labeled mock field using plain HTML, since 2nd-gen field components are not yet migrated. This enables meaningful axe accessibility testing and models correct consumer usage. Contexts shown:InfieldButton.ts@csspropdocumentation updated:--swc-infield-button-heightremoved (no longer exists);--swc-infield-button-paddingadded.Motivation and context
Phase 5 of the infield-button migration workstream translates the 1st-gen
sp-infield-buttonvisual layer to 2nd-gen S2 design tokens and SWC CSS conventions, and adds the Storybook stories surface needed for Phase 6 testing.Related issue(s)
Screenshots (if appropriate)
N/A — CSS and stories changes; visual verification done in Storybook.
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Verify the button sizes correctly at each
sizeattribute valueVerify press-state (downstate) transform animates correctly
Verify quiet variant has no visible border or background
Verify forced-colors (high-contrast) rendering
Device review
Accessibility testing checklist
Keyboard (required)
Tabagain moves past the fieldswc-infield-buttonis never focused (tabindex="-1"); the parent field owns keyboard behaviorScreen reader (required)
swc-infield-buttonannounces its role ("button") and itsaria-label("Decrease quantity" / "Increase quantity") when navigated via the accessibility tree