Skip to content

Commit 583772a

Browse files
committed
fix(expansion): add strong focus indication
Since the color contrast on the expansion panel focus state isn't great, it's a good candidate to have strong focus indication.
1 parent a0aee92 commit 583772a

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/material/expansion/expansion-panel-header.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
align-items: center;
55
padding: 0 24px;
66
border-radius: inherit;
7+
position: relative; // Necessary for the strong focus indication.
78

89
&:focus,
910
&:hover {

src/material/expansion/expansion-panel-header.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import {MatAccordionTogglePosition} from './accordion-base';
4848
matExpansionAnimations.expansionHeaderHeight
4949
],
5050
host: {
51-
'class': 'mat-expansion-panel-header',
51+
'class': 'mat-expansion-panel-header mat-focus-indicator',
5252
'role': 'button',
5353
'[attr.id]': 'panel._headerId',
5454
'[attr.tabindex]': 'disabled ? -1 : 0',

src/material/expansion/expansion.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ describe('MatExpansionPanel', () => {
4949
expect(headerEl.classList).toContain('mat-expanded');
5050
}));
5151

52+
it('should add strong focus indication', fakeAsync(() => {
53+
const fixture = TestBed.createComponent(PanelWithContent);
54+
fixture.detectChanges();
55+
56+
expect(fixture.nativeElement.querySelector('.mat-expansion-panel-header').classList)
57+
.toContain('mat-focus-indicator');
58+
}));
59+
5260
it('should be able to render panel content lazily', fakeAsync(() => {
5361
const fixture = TestBed.createComponent(LazyPanelWithContent);
5462
const content = fixture.debugElement.query(

0 commit comments

Comments
 (0)