-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Popover] center full width popovers on small viewports #4114
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
Conversation
473861a to
54f0c84
Compare
2c6e842 to
d2611d6
Compare
kyledurand
left a comment
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.
Code looks good but I'm wondering if we really need this to be centered, especially if it overrides the alignment prop. Can you ping a designer on this change?
|
we made this change for a component we use in channel apps, which leverages a full width popover on smaller viewports. since the popover has a border radius, we wanted to give a bit of margin between the edge of the screen and the start of the popover
since the chatted with my team's designer (@stephentjoa) and we're happy to align with the Polaris pattern for popovers, so if the left alignment is expected then we can close this. but happy to get this ready to merge otherwise cc @sarahill |
|
I'm ok with the center alignment but agree with Kyle it does feel a little odd if it overrides the alignment prop. That being said I recognize you mentioned the alignment prop doesn't affect full-width popovers. One question I have: do you know if it gets weird on mid breakpoints? If this is the desired affect and it doesn't negatively affect other areas using the component I'm ok with the change |
|
Thanks for that context! I'm cool with that 🚢 |
54f0c84 to
7c571f7
Compare
size-limit report
|
kyledurand
left a comment
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.
Looks good to me just left a couple of non-blocking comments around conventions and past tense in UNRELEASED.




WHY are these changes introduced?
Full width popovers have a max width of
100vw - 3.2rem, which results in a popover that is smaller than the viewport on narrow screens. Since no horizontal margins are applied, the popover defaults to being left aligned on the screen.Given the popover is smaller than the viewport width and has rounded corners, it should be centered aligned on the screen regardless of the preferred alignment.
WHAT is this pull request doing?
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx:🎩 checklist
README.mdwith documentation changes