-
-
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
[docs] Add some Render Props demos #12366
Conversation
@oliviertassinari This is ready for a final review now 🎉 |
and add Popper demo
@jedwards1211 Really nice tradeoff with the API. I'm sorting out the small issues I can find. Let's merge it. |
Woohoo, thanks! |
@jedwards1211 I'm gonna make some changes. I'm moving the component to the lab. |
Okay |
I'm keeping iterating on this component. Well, I come to the conclusion that no matter what I try to do, I'm very close to leaking the abstraction. I'm not happy with everything I have tried, the abstraction is too restrictive, for the value provided in exchange. I'm changing the approach. I'm adding some new render prop demos. I'm gonna try the |
Alright, let's try that and see how that goes. No matter what, @jedwards1211 Thank you for working on it! I was really helpful to see the outcome, it's helping to make better tradeoffs :). |
974f250
to
a217ecf
Compare
a217ecf
to
f67cb4c
Compare
@oliviertassinari what was wrong with the API I created? A week ago you were acting like you were ready to merge it as-is, now you just threw it all away without any coherent explanation of what you don't like about it. Just vague stuff about "the abstraction is too restrictive", "I'm very close to leaking the abstraction", "it's helping to make better tradeoffs". What are you even talking about? Are you trying to discourage me from making any more contributions? I feel really sad that after all the effort I made, developers are no closer to having an quick and easy way to set up menus. Look at the |
I guess I should just release this as a library instead so that you can see how much people are going to like the |
Did you get really really stoned after you wrote this or something? This is the weirdest PR experience I have ever had |
@jedwards1211 I understand your frustration after all the effort you have invested into this pull request! I believe it was an important step that helped making this shift, so again, thank you 🙏 . Let me try to better explain my motivation. Yes, I eager to find an abstraction that is making the usage of the Menu / Popover / Popper simpler to use. I was seeing such potential with your suggestion. Thing started to shift after I dive into the implementation. I realized that a11y was requiring different configurations, the menu, and the popper requires different handling. So I started exploring the alternatives to solve this a11y problem. All the solutions I have tried were cumbersome. At this point, I realized that we could trade the new component for a raw It's also important to understand that it's related to how I try to handle new APIs with the project. I would 💯 rather not abstract something unless I'm sure it's valuable, in the doubt, I would rather do nothing, wait for a clear signal-to-noise ratio (SNR). Publishing the original component as a standalone component is definitely a good path going forward to improve the SNR. |
@oliviertassinari you're talking about My primary goal wasn't to use render props here. Maybe you thought In addition I want something that writes The only reason I implemented I don't think render props is worth pursuing for it's own sake. In the
Also, when it comes to a basic, super-abstract library component, I find |
I do understand your concerns about signal-to-noise ratio and stability; I don't mind taking more time to discuss a new API thoroughly before merging it. My main goal here is to get a super-easy-to-use way of creating menus and popovers into the hands of developers. If I release To me, if developers don't find out about the easiest way to handle menus and popover state, it's a big loss for them and we're not helping them as much as we can. |
@jedwards1211 I'm referring to the difference of how we handle accessibility between the Popover component and the Popper (
Oh, I'm sorry. I though it was. At least, I'm happy to have some demos with the "render props" pattern :).
I understand the concern, I'm also eager to push this part forward. Blueprint is always an interesting source to benchmark on. They use a different strategy for the API (cloneElement): http://blueprintjs.com/docs/#core/components/popover.structure and have this nice concept of interactions: http://blueprintjs.com/docs/#core/components/popover.interactions.
It's an ambitious task, I have some other priorities right now, but it's definitely an area I'm interested in.
Of course! |
Okay, thanks for explaining that, and sorry I failed to notice that distinction between popper and popover, otherwise I would have already designed a solution for it. There are numerous potential solutions to the popover vs. popper issue, listed roughly in order of how much I like them:
If you're interested in using one of these solutions for a component in this library, let me know, otherwise I'll probably go ahead and release the first solution (bring back variant) as material-ui-popup-state |
Blueprint's design seems fairly convenient, but I'm skeptical of it. I try to avoid cloneElement as much as I can, though for debatable reasons (required props that get injected cause flow errors) I think blueprint's API will be less flexible in subtle ways. For instance, what if you want two separate triggers for the same popover, mounted at different places in the app? Easy with PopupState, seems not possible with blueprint's API. At least without creating two duplicate popover elements. |
Another thing we need to consider - someone might want a hover interaction to trigger one type of popup on a component, and a click interaction to trigger another. I don't think this is possible with Blueprint's API? Unless maybe you nest one controller inside the other? that's the most concrete shortcoming of the cloneElement approach I can identify |
@jedwards1211 Did you move the logic into its own library? I thought you had but I can't find it. |
Yeah I still need to add some examples to your docs in a PR. Here it is: https://github.com/jcoreio/material-ui-popup-state |
thanks |
Here is what my new API idea looks like, so you can compare
(old version: #12330)
Closes #12325