Skip to content

bug(menu): Error Host already has a portal attached #1104

@cladera

Description

@cladera

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When open a md-menu programatically using trigger's api it should not throw an exception

What is the current behavior?

When a menu is opened and closed several times it eventually throws an exception:

browser_adapter.js:95 Error: Uncaught (in promise): Error: Host already has a portal attached
    at resolvePromise (zone.js:538)
    at resolvePromise (zone.js:523)
    at zone.js:571
    at ZoneDelegate.invokeTask (zone.js:356)
    at Object.onInvokeTask (ng_zone_impl.js:55)
    at ZoneDelegate.invokeTask (zone.js:355)
    at Zone.runTask (zone.js:256)
    at drainMicroTaskQueue (zone.js:474)
    at HTMLInputElement.ZoneTask.invoke (zone.js:426)
    at MdInput.focus (input.js:202)

What are the steps to reproduce?

http://plnkr.co/edit/1KDM4LwHtlpJQAUbAuur?p=preview

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

I'd want to be able to open and close a menu not only with click event but other events such as "focus".

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

Angular 2.0.0-rc.5 Material 1.0.0-alpha.7-4

Is there anything else we should know?

Besides the error, the plunker does not behave as expected. When using "focus" handler the menu opens but immediately closes. It is necessary to click the input again to open the menu. In my application this does not happen.

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions