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

fix(list, option): ripples disable mouse events on user content #4503

Merged
merged 1 commit into from
May 12, 2017
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/lib/core/option/_option.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
bottom: 0;
right: 0;

// Disable pointer events for the ripple container because the container will overlay the
// user content and we don't want to disable mouse events on the user content.
// Pointer events can be safely disabled because the ripple trigger element is the host element.
pointer-events: none;

// In high contrast mode this completely covers the text.
@include cdk-high-contrast {
opacity: 0.5;
Expand Down
6 changes: 5 additions & 1 deletion src/lib/list/list-item.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<div class="mat-list-item-content" [class.mat-list-item-focus]="_hasFocus">
<div class="mat-list-item-ripple" md-ripple [mdRippleDisabled]="!isRippleEnabled()"></div>
<div class="mat-list-item-ripple" md-ripple
[mdRippleTrigger]="_getHostElement()"
[mdRippleDisabled]="!isRippleEnabled()">
</div>

<ng-content
select="[md-list-avatar],[md-list-icon], [mat-list-avatar], [mat-list-icon]"></ng-content>
<div class="mat-list-text"><ng-content select="[md-line], [mat-line]"></ng-content></div>
Expand Down
5 changes: 5 additions & 0 deletions src/lib/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ $mat-dense-list-icon-size: 20px;
top: 0;
right: 0;
bottom: 0;

// Disable pointer events for the ripple container because the container will overlay the
// user content and we don't want to disable mouse events on the user content.
// Pointer events can be safely disabled because the ripple trigger element is the host element.
pointer-events: none;
}

&.mat-list-item-avatar .mat-list-item-content {
Expand Down
5 changes: 5 additions & 0 deletions src/lib/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,9 @@ export class MdListItem implements AfterContentInit {
_handleBlur() {
this._hasFocus = false;
}

/** Retrieves the DOM element of the component host. */
_getHostElement(): HTMLElement {
return this._element.nativeElement;
}
}