Skip to content

Sidenav issues in safari with Breakpoint Observer. #12479

Open
@Trent-Matthias

Description

@Trent-Matthias

Bug, feature request, or proposal:

Bug

What is the expected behavior?

For the sidenav to properly respond to the breakpoint observer. It should hide the toggle sidenav button in the toolbar when the breakpoint is false.

What is the current behavior?

Does not hide the toggle sidenav button in Safari only.

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

I wanted to update this with 2 StackBlitzs that show the bug happening in safari and the fix.

Here is the StackBlitz with Angular updated to version 7 and using the Breakpoint Observer.

Here is the workaround I found using flex-layout.

The only difference in the code is the observable implementation. The flex-layout one works in safari while the breakpoint observer seems to still be broken.

Simply generate a new project using the cli.
run ng add @angular/material
run npm install @angular/cdk
run ng generate @angular/material:material-nav --name side-navigation
add <app-side-navigation></app-side-navigation> to app.component.html
run the app in safari and change the screen size to trigger the breakpoint observer

What is the use-case or motivation for changing an existing behavior?

This is just broken in Safari as far as I can tell.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Latest versions as of now.

Angular: 7.1.3, Material: 7.1.1, Mac OS Sierra 10.12.6, TypeScript: ~3.1.6

Tested in Safari 11.0.2

Is there anything else we should know?

Was throwing this error on my larger project:

Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'mat-drawer-shown: true'. Current value: 'mat-drawer-shown: false'

This error doesn't usually get thrown with the above implementation.

The easiest way to see the bug is by paying attention to the button that opens the drawer. It should disappear when the breakpoint is not triggered and appear when the drawer is closed. Depending on the window size when first loading the app, the button may never appear or never disappear, whichever state it starts in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/layoutarea: material/sidenav

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions