-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(menu): Close menu even when a list-item was clicked. #1756
fix(menu): Close menu even when a list-item was clicked. #1756
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1756 +/- ##
==========================================
- Coverage 99.14% 99.14% -0.01%
==========================================
Files 90 90
Lines 3845 3843 -2
Branches 497 497
==========================================
- Hits 3812 3810 -2
Misses 33 33
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Got a few small things that are more style and formatting but looks pretty good from here.
@@ -282,7 +281,7 @@ class MDCSimpleMenuFoundation extends MDCFoundation { | |||
let el = evt.target; | |||
|
|||
while (el && el !== document.documentElement) { | |||
if (this.adapter_.eventTargetHasClass(el, cssClasses.LIST_ITEM)) { | |||
if (this.adapter_.getIndexForEventTarget(el) >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick: I'd suggest updating the JSDoc description to explain that it cancels if it's not a child item instead of just a list item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, perhaps just personal preference, but I prefer checks to be as explicit as possible so it might be a good idea to change the comparator from >= 0
to !== -1
@patrickrodee Thanks for the Review. I updated the PR. |
@patrickrodee I rebased my branch on master. Anything else I can do to get this merged? Thanks! |
Previously clicks on a list-item in the page would leave the menu open. Now we check if a item in this menu was clicked and leave the menu open. Fixes #1747
@williamernest I rebased my branch once again and it should apply cleanly now. Let me know if there's anything I can help out with. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Previously clicks on a list-item in the page would leave the menu open. Now we check if a item in this menu was clicked and leave the menu open.
Fixes #1747
@amsheehan You introduced this behavior in 02fe795. Is my fix correct?