Skip to content

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

Merged
merged 15 commits into from
Aug 9, 2024
Merged

Add quiet styling to S2 Picker #6812

merged 15 commits into from
Aug 9, 2024

Conversation

yihuiliao
Copy link
Member

Closes

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@@ -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'
Copy link
Member Author

@yihuiliao yihuiliao Jul 31, 2024

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()

@rspbot
Copy link

rspbot commented Jul 31, 2024

@yihuiliao yihuiliao marked this pull request as ready for review July 31, 2024 19:25
@rspbot
Copy link

rspbot commented Aug 1, 2024

@rspbot
Copy link

rspbot commented Aug 1, 2024

Copy link
Member

@LFDanLu LFDanLu left a 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)

reidbarber
reidbarber previously approved these changes Aug 1, 2024
Copy link
Member

@reidbarber reidbarber left a 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

@snowystinger
Copy link
Member

Screenshot 2024-08-02 at 9 40 08 AM

custom width menu isn't quite wide enough, not sure what's going on there

@snowystinger
Copy link
Member

Screenshot 2024-08-02 at 9 44 36 AM

popover alignment seems off when setting align="end" it's too far left I think, might need that negative margin adjustment? or maybe just need to get rid of the current one?

@@ -80,9 +81,10 @@ function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {
contain: {
labelPosition: {
top: 'inline-size'
}
},
isQuiet: 'none'
Copy link
Member Author

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

Copy link
Member

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

Copy link
Member Author

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
Screenshot 2024-08-06 at 11 03 17 AM
Screenshot 2024-08-06 at 11 03 25 AM

for the second image, i had to apply a width to the form, otherwise, the text would overflow

@yihuiliao
Copy link
Member Author

yihuiliao commented Aug 2, 2024

One minor nit: there might be slightly too much space between the invalid icon and the value in quiet

hmm yeah, it seems like it's because we add marginStart to the FieldErrorIcon. honestly, i'm not sure why we added this but after some digging it's been here since we created the component. maybe someone else knows?

marginStart: 'text-to-visual',
marginEnd: fontRelative(-2),

@rspbot
Copy link

rspbot commented Aug 2, 2024

@adobe adobe deleted a comment from rspbot Aug 2, 2024
@yihuiliao
Copy link
Member Author

yihuiliao commented Aug 2, 2024

Screenshot 2024-08-02 at 9 40 08 AM

custom width menu isn't quite wide enough, not sure what's going on there

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?

@yihuiliao
Copy link
Member Author

popover alignment seems off when setting align="end" it's too far left I think, might need that negative margin adjustment? or maybe just need to get rid of the current one?

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...

@LFDanLu
Copy link
Member

LFDanLu commented Aug 3, 2024

hmm yeah, it seems like it's because we add marginStart to the FieldErrorIcon. honestly, i'm not sure why we added this but after some digging it's been here since we created the component. maybe someone else knows?

Isn't that from the designs for spacing between text value to icon?

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?

Thats probably fine for now IMO, especially since it will just be for tabs for now and thus just always the min popover width

@snowystinger
Copy link
Member

Screenshot 2024-08-05 at 2 59 44 PM

I mean the align start actually doesn't align with the start of the input, instead it's pushed further left. But align end is exactly lined up, it isn't pushed further right.

@rspbot
Copy link

rspbot commented Aug 6, 2024

@@ -80,9 +81,10 @@ function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {
contain: {
labelPosition: {
top: 'inline-size'
}
},
isQuiet: 'none'
Copy link
Member

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

@rspbot
Copy link

rspbot commented Aug 6, 2024

@snowystinger
Copy link
Member

snowystinger commented Aug 6, 2024

I mean the align start actually doesn't align with the start of the input, instead it's pushed further left. But align end is exactly lined up, it isn't pushed further right.

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

@rspbot
Copy link

rspbot commented Aug 7, 2024

@adobe adobe deleted a comment from rspbot Aug 7, 2024
@rspbot
Copy link

rspbot commented Aug 7, 2024

@rspbot
Copy link

rspbot commented Aug 8, 2024

@rspbot
Copy link

rspbot commented Aug 8, 2024

@adobe adobe deleted a comment from rspbot Aug 8, 2024
@adobe adobe deleted a comment from rspbot Aug 8, 2024
@rspbot
Copy link

rspbot commented Aug 8, 2024

@rspbot
Copy link

rspbot commented Aug 9, 2024

@rspbot
Copy link

rspbot commented Aug 9, 2024

@yihuiliao yihuiliao merged commit f56a787 into main Aug 9, 2024
29 checks passed
@yihuiliao yihuiliao deleted the s2-picker-quiet branch August 9, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants