question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dialog: backdrop does not overlap navbar

See original GitHub issue

Bug, feature request, or proposal:

I have an angular 6 application with basically a navbar on top and a content section below. The navbar links trigger different components which are then rendered in the router-outlet of the content-section. When i open a dialog from a component (no matter whether inside the navbar or inside the router-outlet), the dialog does not overlap the navbar (Bootstrap class) on top of the page. I have prepared a StackBlitz (see below) which reproduces this behaviour.

What is the expected behavior?

The Dialog (the backdrop) should overlap the navbar, so that users cannot press links/buttons inside the navbar.

What is the current behavior?

The backdrop overlaps all components, but not the navbar, which appears to be “on top” and therefore is still accessible by the user.

What are the steps to reproduce?

StackBlitz editor: open App in new window (necessary for the navbar to be displayed correctly, as this app does not support small devices): open

You can find the navbar and the router-outlet I mentioned above in the MainComponent.

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

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

I use angular v6.0.4 and material v6.2.1. Affected browsers: FF, IE11, Opera v51, Chrome (these are at least the ones I tested).

Is there anything else we should know?

I managed to fix this behaviour for the moment by adding the following class to my global styles.css: .cdk-overlay-container { z-index: 9999; }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ngi32487commented, Jun 7, 2018

Finally I found the problem, maybe this explanation helps others: The bootstrap class .navbar-fixed-top has z-index: 1030 (refer to bootstrap.css), therefore the .cdk-overlay-container (the parent element for the dialog-backdrop) needs to have a higher z-index in order to overlap.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 10, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dialog: backdrop does not overlap navbar #11704 - GitHub
The Dialog (the backdrop) should overlap the navbar, so that users cannot press links/buttons inside the navbar. What is the current behavior?
Read more >
modal appear behind fixed navbar - Stack Overflow
The simple fix is to simply increase the top margin on the outer modal container to push it down the page slightly and...
Read more >
Modal's are hiding behind NavBar &#38
I had just logged in to report this and see that I'm not the first to catch it. I was surprised to even...
Read more >
Bootstrap Modal Dialog showing under Modal Background
The problem is that the .modal-backdrop overlay sits in the root of the DOM tree while the other content is buried in a...
Read more >
Considerations for Styling a Modal | CSS-Tricks
Typically, if you are on a long, scrolling page, while the modal is open you can still scroll the background, which in most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found