Skip to content

Commit a64bfb7

Browse files
committed
refactor(material-experimental/mdc-list): account for mdc-list handleClick signature change
Accounts for the mdc-list handleClick signature/semantics change as with: material-components/material-components-web#7443.
1 parent 0d3a730 commit a64bfb7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/material-experimental/mdc-list/interactive-list-base.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ export abstract class MatInteractiveListBase<T extends MatListItemBase>
3232
}
3333

3434
_handleClick(event: MouseEvent) {
35-
// The `toggleCheckbox` parameter can always be `true` as it only has an effect if the list
36-
// is recognized as checkbox selection list. For such lists, we would always want to toggle
37-
// the checkbox on list item click. MDC added this parameter so that they can avoid dispatching
38-
// a fake `change` event when the checkbox is directly clicked for the list item. We don't
39-
// need this as we require such list item checkboxes to stop propagation of the change event.
35+
// The `isCheckboxAlreadyUpdatedInAdapter` parameter can always be `false` as it only has an
36+
// effect if the list is recognized as checkbox selection list. For such lists, we would
37+
// always want to toggle the checkbox on list item click. MDC added this parameter so that
38+
// they can avoid dispatching a fake `change` event when the checkbox is directly clicked
39+
// for the list item. We don't need this as we do not have an underlying native checkbox
40+
// that is reachable by users through interaction.
4041
// https://github.com/material-components/material-components-web/blob/08ca4d0ec5f359bc3a20bd2a302fa6b733b5e135/packages/mdc-list/component.ts#L308-L310
4142
this._foundation.handleClick(
4243
this._indexForElement(event.target as HTMLElement),
43-
/* toggleCheckbox */ true,
44+
/* isCheckboxAlreadyUpdatedInAdapter */ false,
4445
);
4546
}
4647

@@ -217,6 +218,7 @@ export function getInteractiveListAdapter(
217218
isCheckboxCheckedAtIndex(index: number) {
218219
return false;
219220
},
221+
notifySelectionChange() {},
220222
notifyAction() {},
221223
};
222224
}

0 commit comments

Comments
 (0)