fix(action-sheet): restore action-sheet-selected class for role="selected"#31109
Open
aeharding wants to merge 1 commit intoionic-team:mainfrom
Open
fix(action-sheet): restore action-sheet-selected class for role="selected"#31109aeharding wants to merge 1 commit intoionic-team:mainfrom
aeharding wants to merge 1 commit intoionic-team:mainfrom
Conversation
…cted" The radio-group rework in ionic-team#30769 unconditionally set `'action-sheet-selected': isActiveRadio` after spreading `buttonClass(b)`, overwriting the class that `buttonClass` emits for `role: 'selected'`. Only override when the button is a radio so the documented public API keeps working. Fixes ionic-team#31090
|
@aeharding is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
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.
Issue number: resolves #31090
What is the current behavior?
Buttons configured with
role: "selected"no longer receive theaction-sheet-selectedCSS class. Userland styling that targets.action-sheet-selected(the documented hook for marking the active option — bold text, custom checkmarks, etc.) silently stopped working as of8.7.12.This regressed in #30769 (
fix(select, action-sheet): use radio role for options). The new render path computes the button's class as:buttonClass(b)already emits'action-sheet-selected': trueforrole: "selected"(via[action-sheet-${button.role}]]: button.role !== undefined), but the second key with the same name overrides it. For any non-radio buttonisActiveRadioisfalse, so the class is dropped from the rendered<button>.Repro
In
8.7.11the Option B button getsaction-sheet-selected. In8.7.12+it does not.What is the new behavior?
action-sheet-selectedbased onisActiveRadiowhen the button actually participates in the radio group (b.htmlAttributes?.role === 'radio'). For non-radio buttons, the class map produced bybuttonClass(b)is left untouched, sorole: "selected"keeps emittingaction-sheet-selectedexactly as it has since the component was introduced.role: "selected"case.This preserves the new radio-group behavior introduced in #30769 (when the button is a radio,
action-sheet-selectedfollowsactiveRadioId) and restores the documented public API.Does this introduce a breaking change?
Other information
Object.assign(Object.assign({}, buttonClass(b)), isRadio && {"action-sheet-selected": isActiveRadio}). WhenisRadioisfalse,Object.assign(target, false)is a no-op and the class set bybuttonClass(b)is preserved.role: "selected"once again rendersclass="... action-sheet-selected ..."on the<button>.Made with Cursor