Skip to content
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(material-experimental/selection): selection column row check box should prevent click event propagation #23789

Open
andrewalderson opened this issue Oct 19, 2021 · 0 comments
Labels
area: material-experimental Issues related to Material experimental packages P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@andrewalderson
Copy link

Feature Description

In the template for MatSelectionColumn the checkbox for each row should not propagate the click event up to the row.

Use Case

When you have a table that uses the entire row as a click zone the event from this checkbox is causing the row click event to be fired.

This is from the current documentation for adding selection to the MatTable

<ng-container matColumnDef="select">
  <th mat-header-cell *matHeaderCellDef>
    <mat-checkbox (change)="$event ? masterToggle() : null"
                  [checked]="selection.hasValue() && isAllSelected()"
                  [indeterminate]="selection.hasValue() && !isAllSelected()">
    </mat-checkbox>
  </th>
  <td mat-cell *matCellDef="let row">
    <mat-checkbox (click)="$event.stopPropagation()"
                  (change)="$event ? selection.toggle(row) : null"
                  [checked]="selection.isSelected(row)">
    </mat-checkbox>
  </td>
</ng-container>

The checkbox for the row prevents the click event from propagating. The template for the new SelectionColumn should do the same thing.

@andrewalderson andrewalderson added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Oct 19, 2021
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material-experimental Issues related to Material experimental packages and removed feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material-experimental Issues related to Material experimental packages P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

2 participants