Skip to content

build: safari focus trapping test failures #9075

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
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
14 changes: 10 additions & 4 deletions src/lib/sidenav/drawer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,17 @@ describe('MatDrawer', () => {

beforeEach(() => {
fixture = TestBed.createComponent(DrawerWithFocusableElements);
fixture.detectChanges();
testComponent = fixture.debugElement.componentInstance;
drawer = fixture.debugElement.query(By.directive(MatDrawer)).componentInstance;
firstFocusableElement = fixture.debugElement.query(By.css('.link1')).nativeElement;
lastFocusableElement = fixture.debugElement.query(By.css('.link1')).nativeElement;
firstFocusableElement = fixture.debugElement.query(By.css('.input1')).nativeElement;
lastFocusableElement = fixture.debugElement.query(By.css('.input2')).nativeElement;
lastFocusableElement.focus();
});

it('should trap focus when opened in "over" mode', fakeAsync(() => {
testComponent.mode = 'over';
fixture.detectChanges();
lastFocusableElement.focus();

drawer.open();
Expand All @@ -431,6 +433,7 @@ describe('MatDrawer', () => {

it('should trap focus when opened in "push" mode', fakeAsync(() => {
testComponent.mode = 'push';
fixture.detectChanges();
lastFocusableElement.focus();

drawer.open();
Expand All @@ -442,6 +445,7 @@ describe('MatDrawer', () => {

it('should not trap focus when opened in "side" mode', fakeAsync(() => {
testComponent.mode = 'side';
fixture.detectChanges();
lastFocusableElement.focus();

drawer.open();
Expand Down Expand Up @@ -717,12 +721,14 @@ class DrawerDynamicPosition {
}

@Component({
// Note: we use inputs here, because they're guaranteed
// to be focusable across all platforms.
template: `
<mat-drawer-container>
<mat-drawer position="start" [mode]="mode">
<a class="link1" href="#">link1</a>
<input type="text" class="input1"/>
</mat-drawer>
<a class="link2" href="#">link2</a>
<input type="text" class="input2"/>
</mat-drawer-container>`,
})
class DrawerWithFocusableElements {
Expand Down