-
Notifications
You must be signed in to change notification settings - Fork 933
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 closing without selecting element on touch inside a Popper #551
Comments
This is also demonstrated on a Material UI demonstration page https://material-ui.com/demos/autocomplete/#downshift. |
Yup, this is an issue for sure. Anyone wanna track down what's going on? |
@izyb Can you confirm the same behavior on Downshift's Storybook ( "react-popper"): In Downshift's Storybook, I ran a cursory test on my iPad, iPhone and with desktop Chrome/FF ( versions ... ) in devtools and responsive mode and "react-popper" tested OK. In the Material-UI Popper at https://material-ui.com/demos/autocomplete/#downshift, I can absolutely duplicate the issue on my iPad, iPhone and with desktop Chrome/FF. However, it appears Material-UI is using Popper straight from popper.js whereas Downshift leverages react-popper.js
FYI, According to its repo page, react-popper is a react wrapper around popper.js. Both libraries stem from the same author. https://github.com/FezVrasta/react-popper I haven't dug deep to understand why Material-UI chose popper.js instead of react-popper but perhaps this is part of the explanation: At this point, based solely on the different libraries used and not on any actual debugging, it appears the difference in libraries is the culprit. It also appears Material-UI's is a newly refreshed component: |
@bresson I also can't reproduce the issue on Downshift's storyboard, and I think you're right that it's an implementation inconsistency between the popper libraries. I'll make an issue on Material-UI about this, and see what needs to be done to resolve the problem. |
I'm looking into it. |
The issue can easily be solved by using the |
I have removed the |
Yep, that reproduces for me. Any ideas what's going on? |
This is still an issue with the latest from everything. Anyone want to spend some time debugging what's going on here? |
I believe it's still an issue mui/material-ui#12679, as soon as it's fixed, we can revert our portal hack and close mui/material-ui#13014 on Material-UI side. |
@kentcdodds @oliviertassinari sorry I've been busy this past month, I'm willing to look at it more in depth this weekend, on both ends |
Thanks! |
@oliviertassinari @kentcdodds I've made a branch here* in which I added an example to the downshift storybook demonstrating the problem. Okay so here's what I've gathered so far: Why is this happening?This is a bug with the passing of the Where are the refs going?You may already be familiar with this, but after doing some digging I learned that this is due to the way React passes the Yay?However, this reveals a more pressing issue, namely that any React component that is not a native element cannot be set as a menu node with Where to go from hereI may be completely off base with this assessment, and I hope you verify my claims. I imagine this might create a lot of work for one or both of these projects (both fantastic, by the way :)). I see that MUI is already considering switching to Recap + loose ends
* for my test on the storybook the ref node is not being set correctly on initial component load so just double click one of the checkboxes to get that set (otherwise the options will just be at the bottom of the screen, its the same outcome though since we just want the target to be outside of |
Thank you so much for that research @izyb! What if instead of applying Seems to have fixed it for me. I was going to say that we could have some validation that things are being used properly, but I don't think we can reliably do that and handle all use cases... Hmmm... Maybe... Especially considering the Anyone wanna make that contribution to the |
@kentcdodds Yes putting I agree that the validation would be difficult to implement and handle all cases. I think adding a |
I'd prefer to come up with this more permanent solution in time for the 3.0.0 release on Monday (in case the solution involves breaking changes). |
I hear ya, it would be nice to have it done by Monday. I'll look into other solutions for now |
I went ahead and pushed the release. I think we're probably good for now. If you come up with something though that'd be super :) |
I'll actually go ahead and close this issue for now. |
@kentcdodds Awesome, thank you, I'm continuing that on Material-UI side :). |
downshift
: 2.1.0node
: 8.11.2npm
: 5.6.0Relevant code or config
What you did:
Tapping items in chrome/firefox devtools device mode, using Material UI's Popper components in the above configuratoin.
Problem description:
Tapping items does not select them, and the menu instantly closes on touchstart.
Suggested solution:
After reading #485, I tried setting the checkActiveElement flag to true on touchstart validation, and solved the problem (no doubt opening up other problems): https://github.com/paypal/downshift/blob/19732576d4f5e72b792bbc555c3c5ef7336883b1/src/downshift.js#L973-L976. I'm not super familiar with debugging this sort of thing; any suggestions would be greatly appreciated!
*Relevant Issue: #485
The text was updated successfully, but these errors were encountered: