Skip to content

Commit 7e4052a

Browse files
committed
fix(button): focus styles not applied to programmatically focused buttons
Currently the tint that is added on top of focused buttons won't show up if the button is focused programmatically, which means that the button won't appear focused in cases like the dialog closing and restoring focus to its trigger. This seems to have been introduced by 5d6920d.
1 parent 4d97271 commit 7e4052a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/demo-app/button/button-demo.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@
7373
<button mat-raised-button (click)="button1.focus()">Focus 1</button>
7474
<button mat-raised-button (click)="button2.focus()">Focus 2</button>
7575
<button mat-raised-button (click)="button3.focus()">Focus 3</button>
76+
<button mat-raised-button (click)="button4.focus()">Focus 4</button>
7677
</div>
7778
<button mat-button #button1 [disabled]="isDisabled" (click)="clickCounter=clickCounter+1">off</button>
78-
<button mat-button color="primary" [disabled]="isDisabled">off</button>
79-
<a href="http://www.google.com" #button2 mat-button color="accent" [disabled]="isDisabled">off</a>
80-
<button mat-raised-button #button3 color="primary" [disabled]="isDisabled">off</button>
79+
<button mat-button #button2 color="primary" [disabled]="isDisabled">off</button>
80+
<a href="http://www.google.com" #button3 mat-button color="accent" [disabled]="isDisabled">off</a>
81+
<button mat-raised-button #button4 color="primary" [disabled]="isDisabled">off</button>
8182
<button mat-mini-fab [disabled]="isDisabled">
8283
<mat-icon>check</mat-icon>
8384
</button>

src/lib/button/_button-base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $mat-mini-fab-padding: 8px !default;
5151
cursor: default;
5252
}
5353

54-
&.cdk-keyboard-focused {
54+
&.cdk-keyboard-focused, &.cdk-program-focused {
5555
.mat-button-focus-overlay {
5656
opacity: 1;
5757
}

0 commit comments

Comments
 (0)