-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(mdc-list): introduce selection change event #7443
feat(mdc-list): introduce selection change event #7443
Conversation
Introduces a new custom event called `MDCList:selectionChange` that fires whenever the selection of the list has changed through user interaction. This matches with the semantics of the native `change` event of input controls. This event is useful as not every type of list has an underlying native control, like in the checkbox-type list, where the `change` event from the control may bubble up. Even for those cases though the native event is not guaranteed to fire in all cases. e.g. it does not fire when a user leverages the `CTRL + A` keybinding we support in the list foundation. This commit adds a new type of event/notification that can be leveraged in the foundation through an adapter method (needed by Angular), or consumers could use it through `MDCList:selectionChange`.
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.
Lots of nice improvements to names and code organization. Thanks for all the effort that went into this PR!
Added a general comment about circumstances in which the underlying control would have received a click event -- I may be misunderstanding the comment, but the intention is for these controls not to be tappable/clickable (via pointer-events: none).
Use consistent quotes and spacing
…Click signature change Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
…Click signature change Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
…Click signature change Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
…Click signature change Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
…Click signature change Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
…Click signature change (#24076) Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443. (cherry picked from commit 97ec228)
…Click signature change (#24076) Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
merged with 7d8ea46 |
…Click signature change (angular#24076) Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
Introduces a new custom event called
MDCList:selectionChange
thatfires whenever the selection of the list has changed through user
interaction. This matches with the semantics of the native
change
event of input controls.
This event is useful as not every type of list has an underlying
native control, like in the checkbox-type list, where the
change
event from the control may bubble up. Even for those cases though
the native event is not guaranteed to fire in all cases. e.g. it
does not fire when a user leverages the
CTRL + A
keybinding wesupport in the list foundation.
This commit adds a new type of event/notification that can be
leveraged in the foundation through an adapter method (needed by
Angular), or consumers could use it through
MDCList:selectionChange
.Note that the custom action event being emitted here is not semantically
equivalent as this one fires regardless of whether the selection has actually changed
or not. This seems like another use-cases, as seen in the MDC menu.
Note: also fixes that the unit tests did not run properly as there was a
fit
leftover pushed tomaster
. This commit fixes that and sets up a lint to prevent this in the future.