I have been facing a really weird issue in Internet Explorer 11 and Microsoft Edge (not in Chrome nor Firefox).
I'm using a navbar with a dropdown menu (styled by Bootstrap).
It looks like this:
-------------------------------------------------------------------
brand image qa1 qa2 user _
-------------------------------------------------------------------
Reporting _
-------------------------------------------------------------------
(the underscore denotes a caret)
The markup is as follows:
<div class="navbar-fixed-top">
<nav class="topbar">
<div class="container">
<!-- hamburger + brand image: I guess not important for the issue -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only"/>
<span class="icon-bar"/>
<span class="icon-bar"/>
<span class="icon-bar"/>
</button>
<a class="navbar-brand" href="/mvc/">
<img alt="" src="/mvc/static/images/client_logo.png" />
</a>
</div>
<!-- quick actions + user menu -->
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="visible-sm visible-md visible-lg">
<a href="#" onclick="SomeHandler(); return false;" title="qa1">
<span class="icon icon-something"/>
</a>
</li>
<li>
<a href="https://localhost:4820/mvc/somewhere" target="_self" title="qa2">
<div class="notification-icon">
<span class="icon-notification-bell"> </span>
</div>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">username<span class="icon icon-user"/>
<span class="caret"/>
</a>
<ul class="dropdown-menu wfc-usermenu" role="menu">
<li>
<a href="/mvc/User/ChangePassword" target="_self">Change password</a>
</li>
<li>
<a href="/mvc/User/Logout" target="_self">Logout</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<nav class="visible-sm visible-md visible-lg navbar navbar-default menubar">
<div class="container">
<ul class="navbar-nav nav" id="menu">
<li class="root-menu-item dropdown"> <!-- #!# -->
<a aria-expanded="false" class="dropdown-toggle" data-toggle="dropdown" href="/mvc/Reporting" role="button">Reporting<span class="caret"/>
</a>
<!-- this ul is not always shown -->
<ul class="dropdown-menu" role="menu">
<li>
<a href="/mvc/Reporting/EmployeeOverview">Employee reports</a>
</li>
</ul>
</li>
<!-- in reality there are more menu items, but you get the idea -->
</ul>
</div>
</nav>
</div>
What happens is that, when the page loads and when I choose 'Reporting' from the menu, nothing happens. The dropdown is not shown. However, I can see that the open
css class is set on the list item marked with #!#
.
When I resize the browser window, the sub menu suddenly shows up (likewise when F12 DOM explorer is open and I select a certain piece of markup), and after that, I can happily open and close the sub menu as many times as I want to.
It feels as if IE (and Edge) can't draw it at first, but are forced to redraw when resizing or doing other things.
The navbar-fixed-top
css class seems to be the deal breaker here, providing the position: fixed
property. If I omit this (and only this) property, everything works fine.
When I set compatibility mode to IE9, it also works (yay!).
There are no errors in the F12 console.
As the page is quite complex, I can't really strip it down to the bare essentials and provide you with a full page (I started doing that, but it would take ages). I'm aware that you will probably not be able to reproduce it and this will probably not provide some concrete answers, but still I'd be happy with some advice ("try this", "try that").
I am using jQuery 2.1.4 and Bootstrap 3.3.4 (next to angular, moment, lodash,...)