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.

Scrollable MatMenu disappears on Mobile Safari just after open animation

See original GitHub issue

Bug, feature request, or proposal:

Bug.

What is the expected behavior?

MatMenu should appear and stay on screen after opening.

What is the current behavior?

MatMenu shows, but just after the fade in animation ends, it becomes invisible. It’s still there, and you can still select items, but it’s invisible.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-xf5tdi?file=app%2Fmenu-overview-example.html Above example is taken from the official documentation, but instead of two items there are sixteen now.

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

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

This happens (at least) on iOS 11.2. with Angular 6.0.3, Angular-Material 6.2.0 and Mobile Safari

Is there anything else we should know?

It appears to be Mobile Safari’s fault. Changing .mat-menu-panel style to overflow: initial and then back to overflow: auto fixes the issue (that’s the workaround I’m using). I’m reporting this here anyhow, since Apple updates their browser once a year at most.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:17
  • Comments:26 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
abeymgcommented, Jul 31, 2018

This is affecting our app as well. Update: Using the lazy rendering feature as mentioned in the issue below seems to resolve it

https://github.com/angular/material2/issues/11366

4reactions
closcacommented, May 8, 2019

Hi, I faced the same issue as the other guys. Mat-menu doesn’t stay open on the first tap. I started to look around and check the solutions listed in this thread, and indeed the fix with overflow did work but I didn’t consider as good enough to achieve the best User Experience (was flickering). Therefore, I decided to get back to basics, and I was wondering if the official examples face the same issues as we did. They work just fine. From this point was necessarily just a second to see what I was doing wrong. Here is the way how I was writing the HTML:

<mat-menu #menu="matMenu">
  <button mat-menu-item>Item 1</button>
  <button mat-menu-item>Item 2</button>
</mat-menu>
<button mat-button [matMenuTriggerFor]="menu">Menu</button>

And here is the way how is written on the official examples from https://material.angular.io/components/menu/examples

<button mat-button [matMenuTriggerFor]="menu">Menu</button>
<mat-menu #menu="matMenu">
  <button mat-menu-item>Item 1</button>
  <button mat-menu-item>Item 2</button>
</mat-menu>

You can notice that the trigger has to be declared before the menu.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iPad Safari scrolling causes HTML elements to disappear and ...
I'm running into a problem wherein large scroll areas cause the elements that are offscreen to appear after a delay when I scroll...
Read more >
Scrolling Issues on Safari/Chrome iOS - Apple Developer
I use jQuery's animate to scroll to the needed element and the scroll listener to detect whether the page is at the right...
Read more >
How To Show Scrollbar On Mobile Safari In Mat-Select
If you open the sidenav on mobile and scroll down, it will disappear with the mask If you then ... MatMenu shows, but...
Read more >
Overlay | Angular Material
The overlay package provides a way to open floating panels on the screen. link Initial setup. The CDK overlays depend on a small...
Read more >
Issues with Safari - Smart Slider Documentation - Help Scout
Slider disappears after flashing. Affected browser(s), Safari (Mac and iOS as well). Affected slider type, All. Official bug ...
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