feat(switch): port pf-v5-switch to pf-v6-switch element#3154
Open
zeroedin wants to merge 11 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: c7bcc8f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ Deploy Preview for patternfly-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Contributor
✅ Commitlint tests passed!More Info{
"valid": true,
"errors": [],
"warnings": [],
"input": "feat(switch): port pf-v5-switch to pf-v6-switch element"
} |
Contributor
Contributor
Contributor
Contributor
Contributor
This comment has been minimized.
This comment has been minimized.
Contributor
Contributor
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<pf-v5-switch><pf-v5-switch>to<pf-v6-switch>web component for PatternFly v6role="switch"via ElementInternalschecked,disabled,reversed,show-check-icon, andaccessible-labelattributes"on"when checked, omitted when unchecked, reverts on form resetchangeevent: callpreventDefault()to reject a toggle and revert stateaccessible-labelattribute, or external<label for="id">--pf-v6-c-switch--*design tokens withlight-dark()hex fallbacksCloses #3038
Intentional divergences from React
labelprop replaced by default slot (slotted text) or external<label for="id">associationisDisabled/isReversed/isCheckedrenamed todisabled/reversed/checked(nois-prefix per web component convention)hasCheckIconrenamed toshow-check-icon(carried over from v5 for clarity)aria-labelabstracted behindaccessible-labelattribute per ADVICE.mdonChangecallback replaced by cancelablechangeDOM eventdefaultCheckednot implemented (React-only uncontrolled pattern; web components use thecheckedattribute directly)"on"when checked, supports form reset to initial statedata-statelabel toggling — React Switch uses a single static label, matching the WCAG APG switch pattern requirement that labels must not change on state changeTest plan
npm run testpasseslocalhost:8000with?rendering=chromelessaccessible-labelsets accessible name without visible text<label for="id">associates correctly and toggles switch on click<label>wrapping switch toggles on click (Firefox double-fire workaround active)"on"value when checked, omits when uncheckedcheckedstatepreventDefault()on change event rejects toggle and reverts stateshow-check-icondisplays check icon when checkedreversedattribute reverses label/toggle layoutAssisted-By: Claude
Testing Instructions
Notes to Reviewers