Skip to content

fix(menu): update to use overlay backdrop - #1534

Merged
jelbourn merged 1 commit into
angular:masterfrom
kara:click-catcher
Oct 21, 2016
Merged

fix(menu): update to use overlay backdrop#1534
jelbourn merged 1 commit into
angular:masterfrom
kara:click-catcher

Conversation

@kara

@karakara commented Oct 19, 2016

Copy link
Copy Markdown
Contributor

@karakara added pr: needs review blocked This issue is blocked by some external factor, such as a prerequisite PR labels Oct 19, 2016
@googlebotgooglebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 19, 2016
@karakara added pr: needs rebase and removed blocked This issue is blocked by some external factor, such as a prerequisite PR labels Oct 19, 2016
Comment threadsrc/lib/menu/menu-trigger.ts Outdated
if (!this._menuOpen) {
this._createOverlay();
this._overlayRef.attach(this._portal);
this._overlayRef.backdropClick().subscribe(() => this.closeMenu());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an e2e that covers this already, but I can add a unit too if you think it will help coverage?

@fxckfxckOct 20, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be

this._overlayRef.backdropClick().take(1).subscribe(()=>this.closeMenu());

to unsubscribe the observer since the backdrop element will be removed from DOM anyway? see https://jsfiddle.net/chy8gLjs/ vs. https://jsfiddle.net/j4p7gq1v/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the backdrop doesn't have anything to do with positioning, I'd do this as a unit tests. We generally want to prefer capturing behaviors with unit tests because they are so much faster.

@fxck I would use .first(), but yeah that should be the the case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing. Anyway I think there's couple more of these potential leaks across the repo. Either not using take/first when it's supposed to happen only once or not unsubscribing on destroy, when it's actually supposed to listen on changes until the component is destroyed. I'll create an issue if I get couple of minutes.

@jelbourn

Copy link
Copy Markdown
Contributor

LGTM

@karakara added the action: merge The PR is ready for merge by the caretaker label Oct 20, 2016
@jelbourn

Copy link
Copy Markdown
Contributor

Looks like you might have to .trim() your textContent for mobile safari

@jelbournjelbourn removed the action: merge The PR is ready for merge by the caretaker label Oct 20, 2016
@kara
karaforce-pushed the click-catcher branch 7 times, most recently from 40602e1 to df1d455CompareOctober 21, 2016 20:31
@karakara added the action: merge The PR is ready for merge by the caretaker label Oct 21, 2016
@kara

kara commented Oct 21, 2016

Copy link
Copy Markdown
ContributorAuthor

@jelbourn Finally passing.

@kara
karaforce-pushed the click-catcher branch 2 times, most recently from a6ab256 to 35eee37CompareOctober 21, 2016 22:21
@angular-automatic-lock-bot

Copy link
Copy Markdown

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.

@angular-automatic-lock-botangular-automatic-lock-botBot locked and limited conversation to collaborators Sep 6, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: mergeThe PR is ready for merge by the caretakercla: yesPR author has agreed to Google's Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue : multiple md-menu opened at the same time

4 participants

@kara@jelbourn@fxck@googlebot