-
Notifications
You must be signed in to change notification settings - Fork 603
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
SelectPanel: Add variant=modal #5817
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: d9640e3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
@@ -143,6 +143,13 @@ | |||
{ | |||
"name": "sx", | |||
"type": "SystemStyleObject" | |||
}, | |||
{ | |||
"name": "data-responsive", |
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.
Note for reviewer: I'm basically opening up an API to make Overlay responsive (fullscreen on narrow screens)
Should we call this responsiveVariant
instead to make it feel more official? Or keep it subtle for now?
It only supports one value "fullscreen" and Overlay does not have variant
so it does follow our object variant pattern 🤔 { narrow: 'fullscreen', regular: 'auto', wide: 'auto' }
feels a bit odd.
Especially because Overlay is usually used by another component that passes it position props like top
and left
like AnchoredOverlay
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.
I don't feel strongly either way, I don't see why not make it public though 👀
@@ -103,15 +103,6 @@ const StyledOverlay = toggleStyledComponent( | |||
max-width: calc(100vw - 2rem); | |||
} | |||
|
|||
&:where([data-variant='fullscreen']) { |
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.
Note for reviewer: Overlay's css module is in GA, so we don't need this css in sx anymore
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.
I think let's keep this for now just in case, in theory the ga FF could still be turned off at any moment? The team can remove this when they remove the FF entirely from this component 🙏
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.
I thought we weren't adding adding css for new features? Based on #5761 (comment)
I recently added this css in #5759, so thought I'll clean it up as well. yay/nay?
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.
yeah I think the issue here is the styles won't be added at all because if FF is not enabled the Overlay classname will not be added so these styles will never make it in (why you need that FF on that other test), the correct way of adding new features without sx styling is to always have it go to css modules, for example if you created a separate class and added it to both (enabled, not enabled) implementations
size-limit report 📦
|
margin: 0; | ||
border-radius: unset; | ||
&:where([data-responsive='fullscreen']) { | ||
@media screen and (--viewportRange-narrow) { |
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.
Note for reviewer: I changed full screen to only be a responsive thing instead of variant you can apply whenever. data-variant
→ data-responsive
@@ -459,6 +464,16 @@ export function SelectPanel({ | |||
role: 'dialog', | |||
'aria-labelledby': titleId, | |||
'aria-describedby': subtitle ? subtitleId : undefined, | |||
...(variant === 'modal' | |||
? { | |||
/* override AnchoredOverlay position */ |
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.
Note for reviewer: This is where all the shame lies. We are still using an AnchoredOverlay, but then we override it's position by directly passing top, left, etc to overlayProps going down
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.
fair
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.
Mostly LGTM, just some questions/suggestions.
Was also wondering if you could elaborate on the feasibility of #5230? I see from the comments it was reverted due to failing integration checks, wondering how significant those were to warrant going this route. I'm ok with this solution, was just curious
@@ -103,15 +103,6 @@ const StyledOverlay = toggleStyledComponent( | |||
max-width: calc(100vw - 2rem); | |||
} | |||
|
|||
&:where([data-variant='fullscreen']) { |
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.
I think let's keep this for now just in case, in theory the ga FF could still be turned off at any moment? The team can remove this when they remove the FF entirely from this component 🙏
@@ -143,6 +143,13 @@ | |||
{ | |||
"name": "sx", | |||
"type": "SystemStyleObject" | |||
}, | |||
{ | |||
"name": "data-responsive", |
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.
I don't feel strongly either way, I don't see why not make it public though 👀
@@ -459,6 +464,16 @@ export function SelectPanel({ | |||
role: 'dialog', | |||
'aria-labelledby': titleId, | |||
'aria-describedby': subtitle ? subtitleId : undefined, | |||
...(variant === 'modal' | |||
? { | |||
/* override AnchoredOverlay position */ |
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.
fair
It's definitely still feasible, but doesn't feel worth the effort anymore 🤔 I don't mind if the current solution stays long term too
Thank you! I was about to debug |
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.
Hey! This looks good. Two minor things:
- I think we should include the
x
icon here that does the same thing thatonCancel
would. This has always been the case in Figma. I know it may seem redundant, but I think the intent here is that it's expected behavior to have a close button in the top right of a modal dialog – in addition to the Cancel button in this case.

- I discussed & confirmed w/ Primer design that the list items in the SelectPanel modal should use radios for single selection. Context

@emilybrick, Oops i only added the close icon button to the css module (feature flagged), not without it. Added it to both now! |
<Box | ||
sx={enabled ? undefined : {display: 'flex', flexDirection: 'column', height: 'inherit', maxHeight: 'inherit'}} | ||
className={enabled ? classes.Wrapper : undefined} | ||
<> |
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.
Note for reviewer: Recommend to review this with hide whitespace
👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/370114 |
🔴 golden-jobs completed with status |
Note
Current status:
main
is failing integration tests, so need to run integration tests again once that is cleared upNote: This PR does not include radio icons for single selection in a modal
Features:
Adding
variant=modal
does 3 thingsonCancel
a required proponCancel
Shortcut
We are still using
AnchoredOverlay
underneath. But, forvariant=modal
, we override its position by directly passingtop
,left
, etc. tooverlayProps
going down to the OverlayThe ideal super clean solution would have been to refactor SelectPanel and conditionally use
useAnchoredPosition
instead of AnchoredOverlay for variant=anchored. Something I did attempt in #5230 earlier but had to revert.This shortcut is easier to implement and touches less surface area.
Rollout strategy
Testing & Reviewing
Merge checklist