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(button): persist theme color of button when leaving hover state #3629

Merged
merged 1 commit into from
Mar 17, 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
17 changes: 8 additions & 9 deletions src/lib/button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
&.mat-warn .mat-button-focus-overlay {
background-color: mat-color($warn, 0.12);
}

&[disabled] .mat-button-focus-overlay {
background-color: transparent;
}
}

// Applies a property to an md-button element for each of the supported palettes.
Expand Down Expand Up @@ -54,20 +58,15 @@
$foreground: map-get($theme, foreground);

.mat-button, .mat-icon-button, .mat-raised-button, .mat-fab, .mat-mini-fab {
&.cdk-keyboard-focused {
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove this one @willshowell?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing this line means that the overlay always has the correct coloring applied. %mat-button-base takes care of showing/hiding it when the button has .cdk-keyboard-focused.

Copy link
Member

Choose a reason for hiding this comment

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

Alright, makes sense.

@include _mat-button-focus-color($theme);
}
// Appy color to focus overlay.
// The focus overlay will be visible when any button type is focused or when
// flat buttons or icon buttons are hovered.
@include _mat-button-focus-color($theme);
}

.mat-button, .mat-icon-button {
@include _mat-button-theme-color($theme, 'color');
background: transparent;

// Only flat buttons and icon buttons (not raised or fabs) have a hover style.
// Use the same visual treatment for hover as for focus.
&:hover {
@include _mat-button-focus-color($theme);
}
}

.mat-raised-button, .mat-fab, .mat-mini-fab {
Expand Down
6 changes: 0 additions & 6 deletions src/lib/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
opacity: 1;
}
}

&[disabled]:hover {
&.mat-primary, &.mat-accent, &.mat-warn, .mat-button-focus-overlay {
background-color: transparent;
}
}
}

.mat-raised-button {
Expand Down