Skip to content

fix(material/list): pointer events disabled around content #26012

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

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/material/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ a.mdc-list-item--activated {
// explicitly set `display: block`
.mat-mdc-list-base {
display: block;

// MDC sets `pointer-events: none` on these elements,
// even though we allowed interactive content in them.
.mdc-list-item__start,
.mdc-list-item__end,
.mdc-list-item__content {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking: Should content allow for pointer-events:none? I don't fully recall without looking, but might be needed for anchor elements and disabling?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MDC's code doesn't have any comments on why the pointer-events: none is there. I don't think that it's there for anchor list items that are disabled, because it's only a wrapper around the projected content. My best guess is that it's used as a shorthand to switch the cursor to the default and disable text selection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

pointer-events: auto;
}
}

// MDC expects that the list items are always `<li>`, since we actually use `<button>` in some
Expand Down