material icon indicating copy to clipboard operation
material copied to clipboard

Issue with md-menu backdrop silently failing and not allowing anything underneath to be clicked. Angular 1.3.15

Open anatolyg opened this issue 10 years ago • 3 comments

Whenever I click on the button triggering in md-menu, the backdrop gets inserted and then silently fails, making it impossible to click anything underneath. As far as I can see, this breaking change was introduced here, around Dec 1st: https://github.com/angular/material/commit/097b799d6104e4121f0556efb1c21b47bdcd2613#diff-05fc7240a1c46bdb972d8a2f01931ccdR59

Basically, if $animate.enter doesn't get passed an "after" element, it uses element.prepend to insert the backdrop into the DOM. Unfortunately, $document[0].body is a naked DOM element, which doesn't support the method prepend. This silently fails and leaves the site in a state where nothing is clickable.

Replacing $document[0].body with $document.find('body') fixes the issue.

Found the same issue in the md-select directive as well.

anatolyg avatar Dec 30 '15 02:12 anatolyg

+1 to this bug and the fix documented above. thank you @anatolyg
We noticed that the angular material demos have been running on Angular 1.4. We are still running 1.3 in our project. It's possible this may be related to changes with $animate in 1.4... so it works with ng v1.4 but not v1.3?

angular animate 1.3 to 1.4 docs

due to 1cb8584e, $animate will no longer default the after parameter to the last element of the parent container. Instead, when after is not specified, the new element will be inserted as the first child of the parent container.

bshir avatar Dec 30 '15 19:12 bshir

@bshir good point, animate received a large refactor, and the enter function works differently now. I'll test w/ angular 1.4

anatolyg avatar Dec 30 '15 19:12 anatolyg

BTW -- upgrade to 1.4 fixed this issue.

anatolyg avatar Apr 28 '16 22:04 anatolyg