-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Menu] Fix nested menus that can't be clicked issue #3947
Conversation
This fixes a regression that was introduced in mui#3360. The previous `click-awayable` mixin listened on `mouseup` and `touchend` events and the new `ClickAwayListener` was implemented to use `mousedown` and `touchstart` events. This commit changes the events to mimick the behavior from the original mixin. Resolves mui#3818
Note: I haven't thoroughly tested the impact of this change. It does fix the nested menu issue, but I haven't checked to see if it impacts any of the other components that use If someone else could give this a test, that'd be much appreciated! |
Also, I know this wasn't slated for the beta, but this might not be a bad one to get in before releasing. |
@newoga I agree 👍 |
Something is weird. I'm having this warning when selecting a nested menu item (level > 2):
|
@newoga do you need a hand looking into this? |
@nathanmarks I can continue this later tonight, but feel free to take a stab if it's holding things up (just shoot me a ping and let me know). I've already identified the issue is here with this setState call in Popover.js#148 Edit: More specifically, the setState is getting call after an unmount, probably due to the timeout. |
@newoga sweet mother of god, I'll ping you on gitter |
EDIT: I just realised that by removing the prop in the PR below, you cannot highlight items on previous menu levels Seems like this is playing a part here, removing it allows me to open all levels with However, I still get this issue 😟
|
I went back to the PR before the mixin was removed. Even though the 2nd level works there.... the 3rd doesn't -- @#@!#QDSS*(D& |
Well, N levels doesn't work in |
Not to mention that our nested menu doesn't have the right UX anyways. It should support triggering the next level by hover state to mimic application menus (like google docs, which is what the spec examples kind of copy) |
4 levels of nested menu is bad UX to start with, so if the regression can be fixed at previously supported nesting, that's good enough for now IMHO. 👍 |
@mbrookes it can, but not without that warning so far 😄 |
@newoga what's the plan here -- try and fix that error with 2 nested? Feels like punching a brick wall. lol. |
@nathanmarks I'm stumped and my fists are bloody. |
👊 🔴 |
We have some deep rooted issues with Case in point: when you scroll a page with a Have you guys considered that this bug may just not be fixable with the current component design? That it is inherently flawed? |
@nathanmarks - I agree on all fronts, however this is a regression, not a bug - i.e. it worked before. Given that a mixin is just a means of sharing code between components (and merging lifecycle hooks etc), and that whatever code But if someone wants to take on improving |
@mbrookes I went back to |
@nathanmarks - no, but that isn't what we're talking about, as you well know. 😄 If we can fix the regression to support 3 levels, as it did at 0.14.4, that's sufficient for 0.15.0, or until Popover / Menu get an overhaul in the future. |
Just some quick context to clarify some things because this has gotten really confusing:
tl;dr As far as I'm concerned, #3360 is fixed by this PR from a regression standpoint (not fixed from a bug standpoint if you consider N levels of nesting). The |
Yeah, I think the click behaviour of this menu is not correct for a default anyways so we should not invest too much time in making sure it is perfect right now. Are you suggesting we just let the warning slide for the time being? |
Yeah I was literally writing another comment to address that point. I do think we should seriously consider just letting it slide until the component design can be fixed. IMO, the warning provided by React is there for this very reason, to indicate when something may not be designed properly. Any hacks we implement now to fix a noop warning that doesn't hit production ignores the root issue. I can detail my (somewhat limited) findings later, but this problem is really not straightforward. It's also appears timing related (primarily as it relates to Popover animations) which makes reproducing in various commits and with various changes applied very difficult. Add that to @nathanmarks' point that the behavior should change regardless of the implementation, I think the time may be better spend investigating alternative approaches to some of these components. |
@newoga I haven't found any other issue with this change. const clickAwayEvents = ['mousedown', 'touchstart']; as a native |
This fixes a regression that was introduced in #3360. The previous
click-awayable
mixin listened onmouseup
andtouchend
events and the newClickAwayListener
was implemented to usemousedown
andtouchstart
events. This commit changes the events to mimick the behavior from the original mixin.Resolves #3818