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

[Popper] Support marginThreshold prop like in Popover #39

Closed
oliviertassinari opened this issue Aug 11, 2023 · 8 comments
Closed

[Popper] Support marginThreshold prop like in Popover #39

oliviertassinari opened this issue Aug 11, 2023 · 8 comments
Labels
component: popover The React component. enhancement This is not a bug, nor a new feature

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 11, 2023

Summary 💡

The Popper component is missing the equivalent of the marginThreshold prop of the Popover.

As we are trying to revamp the Popover component, I think we must port this feature back. We have seen in #413 and mui/mui-x#10009 that this prop matters, we can't get away without it.

Examples 🌈

Motivation 🔦

Great UX.

This also connects a bit with the effort to modernize the Popper component of mui/material-ui#32587 (comment).

cc @michaldudak

@oliviertassinari oliviertassinari changed the title [Popper] Support marginThreshold like in Popover [Popper] Support marginThreshold prop like in Popover Aug 11, 2023
@michaldudak
Copy link
Member

we are trying to deprecate & remove the Popover component

Are we? Is there an issue about this? I thought the Popover was intended to be a high-level building block for popups, dialogs, select listboxes, etc.

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Aug 30, 2023

@michaldudak I have updated the description, great point.

I'm not sure about "dialogs" though. I don't see how it would fit. The problems we need to consider:

  • Positioning: Solved with Popup/Popper
  • Animation: Solved with animation components
  • Focus: Solved with TrapFocus
  • Modal vs. non-modal: Solved with Modal, with Portal built in.

I would imagine that the value of Popover is to remove the duplication for very frequent combination of the above. Dialog feels hyper specialized, it could directly compose these 4 components. What I see frequently needed is a slick way to display small element elements on the page, typically, it's always the same animation between Context Menu, Menu, Select, Dropdown, Combobox, Date Picker, Color Pickers, Data Grid pannel.

Now, I think Popover source should be very simple, so developers can easily eject and built their own.

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 14, 2023

mui/mui-x#10009 (comment) raises the question on what the default value for this prop should be.

@michaldudak michaldudak changed the title [Popper] Support marginThreshold prop like in Popover [base-ui][Popper] Support marginThreshold prop like in Popover Oct 11, 2023
@michaldudak michaldudak transferred this issue from mui/material-ui Feb 27, 2024
@michaldudak michaldudak changed the title [base-ui][Popper] Support marginThreshold prop like in Popover [Popper] Support marginThreshold prop like in Popover Feb 27, 2024
@michaldudak michaldudak added the enhancement This is not a bug, nor a new feature label Feb 27, 2024
@oliviertassinari oliviertassinari added the component: popover The React component. label Jul 18, 2024
@michaldudak
Copy link
Member

michaldudak commented Sep 10, 2024

The new Popover (and other popover-like components) supports the collisionPadding prop that defines a distance from the popover to its collision boundary.

https://master--base-ui.netlify.app/components/react-popover/

@github-project-automation github-project-automation bot moved this from Backlog to Done in Base UI Sep 10, 2024
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 10, 2024

Nice 👍, 5px might be enough, we will see. I guess we don't need a demo for this.

For the prop name, "padding" feels strange, it's more of a "margin"?

@michaldudak
Copy link
Member

Depends how you look at it, I guess - it's a padding of a collision box. Maybe margin would be a bit more intuitive though, it's hard to say.
cc @colmtuite

@colmtuite
Copy link
Contributor

@michaldudak We should stick with collisionPadding for easier migration from Radix. I think the default should be 0, though it's not really important. Radix also supports an object for setting independent values for each side, that's something to consider.

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 11, 2024

We should stick with collisionPadding for easier migration from Radix

@colmtuite Are people frequently using this prop? If not, we could argue that it's an opportunity to see what the optimal name could be.

We could also have a deprecated prop with the Radix prop name (actually true for everything else) so it's super easy to migrate. Maybe to consider? Actually, could do the same with Material UI prop names. Idea moved to #601.

I think the default should be 0, though it's not really important.

The initial proposal for not using 0 is that it seems to create confusing UIs:

I'm not sure about the use cases for being right on the edges of the screen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: popover The React component. enhancement This is not a bug, nor a new feature
Projects
Archived in project
Development

No branches or pull requests

3 participants