-
-
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
[Modal] Migrate to emotion + unstyled #24857
Conversation
@material-ui/core: parsed: +0.37% , gzip: +0.23% |
Any ideas why karma fails?
Seen other pull request but their just fail because of timeout https://app.circleci.com/pipelines/github/mui-org/material-ui/37775/workflows/a3c068e5-582a-4e66-9564-d7f0eccd2d54/jobs/223216
|
@povilass It has been failing like this for a week. I can even reproduce it locally. I was planning to solve/spend time on this issue. There is a high variance in the builds in BrowserStack, for some reason, sometimes it runs in 40s, sometimes in 3min+. cc @eps1lon CircleCI isn't the only one with unstable builds durations 🙃 |
@oliviertassinari well that's disappointing, but at least I know code is not failing. |
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.
The modal is tricky. We can't simply migrate it to emotion as it would break its current value proposition. It's meant to be very lightweight without any style library dependencies.
I see two possible options:
- We don't do anything about it, we keep the current inline style tradeoff
- We add an unstyled version of it
@oliviertassinari so you can decide which are you preferring and we could close this pull request and I would open a new request if you want to migrate it to UnstyledModal. But keep in mind Modal uses theme to get zIndex. |
@povilass I think that option 2 would be better longer-term. It would normalize the pattern. Right now, it's somewhat a hybrid. For instance, we have a |
@oliviertassinari Ok got, I would suggest updating the v5 list with NO_NEED_FOR_CONVERSION and move this change to the next iteration to the Unstyled package. |
@povilass Well, I still think that it needs to be migrated to emotion, but it needs the unstyled version too, otherwise, it's a regression for many developers using it as an alternative to https://github.com/reactjs/react-modal. |
@oliviertassinari Ok gonna try to add Unstyled version too. |
@povilass Sounds great, the Slider is a great one as a model. |
@oliviertassinari I have 1 question about moving Modal to Unstyled package, it depends on Portal and TrapFocus I have to move those to unstyled package also otherwise I can not migrate Modal is it ok or not? Update: I think we should first move TrapFocus, Portal and Backdrop(has Fade props too) to unstyled version. |
Portal and TrapFocus are already unstyled. We could indeed move them to the other package ( |
Backdrop migrated to emotion, probably can be moved to unstyled also and backdrop depends on Fade which already is unstyled just a transition. Fade, Portal and TrapFocus can be moved with different pull requests now. Or should we merge Modal to emotion now close this issue and moved everything with other pull requests to unstyled package one by one? Do not want to mix emotion and unstyled issues in this one pull. If you will let me I can create pull requests for each component and move it slowly. |
@povilass Yes, I agree. For the Modal to be unstyled, it needs its leaves to be too.
I think that we should move one component at a time, starting from the most nested blockers. I imagine the following possible iterations:
cc @eps1lon |
@oliviertassinari I mean Backdrop depends on Fade props check and Fade depends on Transition props probably also can be moved to unstyled? Or BackdropUnstyled component can be without transition UPDATE: I think unstyled components should be without transition itself but you can pass components in core like Slider does with additional properties. |
@povilass Yes, you got the idea. Transitions don't make sense for unstyled components. The styled Backdrop should inject it's transition. |
Gonna move it to unstyled and remove a simple backdrop so don't need a review for now |
TODO: Updating docs (for myself) @oliviertassinari I have a problem with how to resolve exit property it's duplicate in both components. It depends on the transition component passed as a child. Should I move exit handling to Modal and pass it to ModalUnstyled as prop (both need to apply current styles and classes)? |
There is a problem with typings where OverridableComponent returns JSX.Element.
But BackdropComponent requires ComponentType or ElementType
And can't resolve this issue because of this difference in SpringModal.tsx UPDATE:
|
Rebased on HEAD. |
Ok great, a lot of work done by this task did not even realize it will close other issues xd |
@povilass Definitely fixing old issues :). What do you think about handling the documentation of unstyled before we merge? |
I think both are needed. The question is why? Same problem with newly added classes which does not exist in the unstyled components. |
@povilass I don't follow your point. For the documentation, I was referring to having a |
@oliviertassinari Oh ok, though you are talking about API documentation of Modal and ModalUnstyled, yes later I can provide a demo for the unstyled one too. |
@oliviertassinari need to re-run the test because everything runs for me and I updated docs. |
@povilass Great job here! This wasn't an easy one :) |
I call it medium difficulty but with a lot of boilerplate still need to improve in the documentation. |
Closes #20957
Closes #16442