-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add quiet styling to S2 Picker #6812
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
@@ -113,7 +113,8 @@ export const fieldInput = () => ({ | |||
contain: { | |||
// Only apply size containment if contain-intrinsic-width is supported. | |||
// In older browsers, this will fall back to the default browser intrinsic width. | |||
'@supports (contain-intrinsic-width: 1px)': 'inline-size' | |||
'@supports (contain-intrinsic-width: 1px)': 'inline-size', | |||
isQuiet: 'none' |
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.
honestly not too sure about this but without it, there's too much spacing between the value text and the dropdown chevron which doesn't match the figma designs for isQuiet
i didn't notice any other changes to other components that also used fieldInput()
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.
Not sure if it is expected or not, but I noticed that the label for a quiet Picker sizes itself with respect to the length of the text content in the picker, whereas the label in v3 seems to prefer having the label as a single line regardless of the picker's selected text: https://reactspectrum.blob.core.windows.net/reactspectrum/1dcc8705115364a2c2ead2ececae8883dd6e9d07/storybook/index.html?path=/story/picker--quiet&providerSwitcher-express=false. Not sure if this is important if we are only adding quiet for Tabs (if that is even the case, lemme know if I'm misremembering)
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.
One minor nit: there might be slightly too much space between the invalid icon and the value in quiet
@@ -80,9 +81,10 @@ function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) { | |||
contain: { | |||
labelPosition: { | |||
top: 'inline-size' | |||
} | |||
}, | |||
isQuiet: 'none' |
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.
adding this allows the label be on a single line regardless of the picker's selected text
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 guess we'll have to figure out if we want this, might interfere with form layouts
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 im open to either. for tabs, there isn't going to be a label anyway so this won't matter too much. i added this to mainly to match the v3 behavior. i don't really think isQuiet should be used in forms given that the other form components don't have isQuiet styles but if you're curious, this is what it looks like having an isQuiet Picker in a form
for the second image, i had to apply a width to the form, otherwise, the text would overflow
hmm yeah, it seems like it's because we add react-spectrum/packages/@react-spectrum/s2/src/Field.tsx Lines 329 to 330 in 617ad2e
|
actually, what is the expected behavior for the width of a popover when a custom width is applied for quiet pickers? after i pushed the latest code, the width of the popover is not the same as the applied custom width because i had to add "fit-content" to the width of the button for quiet pickers to prevent the focus ring from extending past the dropdown chevron. as a result, the popover will always be the width of the trigger/button (unless the width of the trigger is less than the min width) i tried it out in v3 and seems like if you apply any custom width to a quiet picker, the width of the popover will always be whatever the width of the trigger is, so S2 now matches the behavior of V3 but is this what we want? |
it looks fine to me? or maybe im misunderstanding something but it looks to me like the popover is aligning to the end of the trigger. maybe my eyes just aren't picking it up... |
Isn't that from the designs for spacing between text value to icon?
Thats probably fine for now IMO, especially since it will just be for tabs for now and thus just always the min popover width |
@@ -80,9 +81,10 @@ function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) { | |||
contain: { | |||
labelPosition: { | |||
top: 'inline-size' | |||
} | |||
}, | |||
isQuiet: 'none' |
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 guess we'll have to figure out if we want this, might interfere with form layouts
Ah I see this was actually the behavior in v3 as well. I just checked the storybook for it. I think it's ok to leave it how you had it because I think we want that slight offset at the start. We can handle the align end case later. Would you mind opening a discussion with Spectrum about it? Sorry for the back and forth |
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: