-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(action-button): allow change events to bubble and pierce shadowdom #3614
Conversation
6cff0ab
to
e7ef339
Compare
e7ef339
to
46f173e
Compare
Tachometer resultsChromeaction-bar permalink
action-button permalink
action-group permalink
action-menu permalink
menu permalink
number-field permalink
overlay permalink
picker permalink
popover permalink
slider permalink
split-button permalink
tooltip permalink
Firefoxaction-bar permalink
action-button permalink
action-group permalink
action-menu permalink
menu permalink
number-field permalink
overlay permalink
picker permalink
popover permalink
slider permalink
split-button permalink
tooltip permalink
|
@@ -363,6 +363,7 @@ export class ActionGroup extends SizedMixin(SpectrumElement, { | |||
|
|||
private manageChildren(changes?: PropertyValues): void { | |||
this.buttons.forEach((button) => { | |||
button.toggles = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could cause an issue when a consumer leverages an Action Group without selects
but Action Buttons with toggles
in order to manage the selection of elements in the group via some custom algorithm.
I think with the change to Action Button, that we want to move away from listened on click
and to listening on change
and then event.stopPropagation()
ing the child event. Much like we see in Radio Group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Westbrook Does that mean we want to dispatch a change event for all clicks on action buttons? Currently change events are only dispatched for action buttons that toggle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this is a bit more complex than Radio Group.
The context is that if the Action Group should dispatch change
events (selects === 'single' | 'multiple') we shouldn't prevent child Action Buttons from dispatching change
events (button.toggles = false;
). In that context we should listen for those change
events and event.stopPropagation()
on them. We likely also want to event.preventDefault()
them, as the Action Button is a controller component of the Action Group in that case and does not get to determine its own state.
Does that make next steps here clear enough?
46f173e
to
bc7b8a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickschaap, made a couple of changes and think this is OK to land. Can you confirm whether you think this would cover your original use case before we merge?
@Westbrook LGTM thanks! |
Description
Action button change events should bubble and be composed to match behavior with other SWC components which fire change events such as
sp-switch
andsp-checkbox
Related issue(s)
Motivation and context
How has this been tested?
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.