Components: Overlay is not destroyed while navigating using Browser's Back/Forward button (RouteReuseStrategy is used)

Created on 16 Dec 2019  路  3Comments  路  Source: angular/components

Reproduction

https://angular-hlrhkp-pzxidw.stackblitz.io/

Steps to reproduce:

  1. Click on the navigate to second page link.
  2. Click on Browser Back Button and Open the select box .
  3. Click on the browser forward button to navigate.

Expected Behavior

What behavior were you expecting to see?
The overlay of the previous component should be destroyed, when the browser navigation buttons clicked

Actual Behavior

What behavior did you actually see?
The overlay of the material persists even after the page is routed to next page

Environment

  • Angular:
  • CDK/Material: 5.21
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
P3 cdoverlay help wanted

Most helpful comment

The overlay has an option now called disposeOnNavigation, we should probably either set this as the default behavior for menu/tooltip/select, etc., or at least add an option to make it the default.

All 3 comments

This issue is not present in v8, I copied your example: https://stackblitz.com/edit/cdk-v8-overlay-issue-17973 and it works fine.

I was able to reproduce the issue based on the example based on v8. https://cdk-v8-overlay-issue-17973-zc2zdd.stackblitz.io/

The overlay has an option now called disposeOnNavigation, we should probably either set this as the default behavior for menu/tooltip/select, etc., or at least add an option to make it the default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

savaryt picture savaryt  路  3Comments

LoganDupont picture LoganDupont  路  3Comments

theunreal picture theunreal  路  3Comments

dzrust picture dzrust  路  3Comments

shlomiassaf picture shlomiassaf  路  3Comments