Skip to content
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

Ability to override Modal container inside Popover #11733

Closed
2 tasks done
morhekil opened this issue Jun 6, 2018 · 0 comments
Closed
2 tasks done

Ability to override Modal container inside Popover #11733

morhekil opened this issue Jun 6, 2018 · 0 comments
Assignees
Labels
component: modal This is the name of the generic UI component, not the React module! component: Popover The React component. new feature New feature or request
Milestone

Comments

@morhekil
Copy link

morhekil commented Jun 6, 2018

  • This is a v1.x issue (v0.x is no longer maintained).
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Popover allows to render itself in a non-Modal container (e.g. Portal) to support non-background-blocking components and behaviours which still render outside of parent component's DOM tree.

Current Behavior

Popover always renders inside a Modal container, blocking the background.

Context

When upgrading to MUI 1.x, we had to reimplement a couple of more complex components we were using - things like ChipInput and AutoComplete. Our use case is a bit more complex that what is shown in Autocomplete demo, as we render these components inside modal dialogs - and we ran into a problem when the rendered lists were getting cut off by dialog's boundaries.

Popover seems to provide the perfect way to solve this, with the only exception - it renders itself inside its own Modal, which blocks the background etc. But going lower level with Portal also means that we need to reimplement the rest of the logic that exists in Popover (mostly things around its positioning), which seems like a waste. There's also no easy way to extend the component or pull out just the position logic for reuse - as Popover exports only its withStyles wrapper, and not the naked Popover component itself.

For the current working solution we used a version of Popover which is literally a full copy of the component, with a single change - the line that render Modal component here got replaced with Portal instead:

      <Portal container={container} {...other}>

This was the only change needed, and I'm wondering what would be MUI's preferred approach to support this in Popover itself? Is implementing a component prop (similar to how it for for ListItem etc) the way to go here? E.g. <Popover component="portal"> to have it use Portal instead.

I'll be happy to take a shot at PR myself, just want to make sure this is the correct approach for a case like this. If this is implemented - it will also enable Dropdown-like functionality requested in #9893, and return the possibility to render non-modal popovers discussed in #8202.

@oliviertassinari oliviertassinari self-assigned this Jun 30, 2018
@oliviertassinari oliviertassinari added this to the post v1.0.0 milestone Jul 3, 2018
@oliviertassinari oliviertassinari removed their assignment Jul 3, 2018
@oliviertassinari oliviertassinari added component: Popover The React component. new feature New feature or request labels Jul 6, 2018
@oliviertassinari oliviertassinari self-assigned this Jul 6, 2018
@oliviertassinari oliviertassinari added the component: modal This is the name of the generic UI component, not the React module! label Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: modal This is the name of the generic UI component, not the React module! component: Popover The React component. new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants