Skip to content

feat(picker): refactoring template markup, testing token passthroughs #3792

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

Conversation

aramos-adobe
Copy link
Contributor

@aramos-adobe aramos-adobe commented May 19, 2025

Description

Refactored the Picker component template to encapsulate the popover, help text, label, and spectrum-Picker-button within a unified structure. The spectrum-Picker now acts as the root class, allowing for more targeted button styles and streamlined --mod and style passthroughs to child elements.

For example, --mod-popover-animation-distance—defined in the Popover—now registers correctly within the Picker, enabling size variant tokens to apply expected values when the corresponding size class is used.

New token

--spectrum-picker-popover-animation-distance

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

  1. Open the storybook for the picker component:
    - [ ] Correct --spectrum-picker-popover-animation-distance token changes according per size variant
    - [ ] Layout still works for top and side labels
    - [ ] Test grid environment still in tact

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

Screenshots

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented May 19, 2025

🦋 Changeset detected

Latest commit: 6f2e972

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@spectrum-css/picker Major

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

@aramos-adobe aramos-adobe marked this pull request as draft May 19, 2025 22:20
Copy link
Contributor

github-actions bot commented May 19, 2025

File metrics

Summary

Total size: 1.42 MB*

Package Size Minified Gzipped
picker 29.17 KB 27.91 KB 3.54 KB

picker

Filename Head Minified Gzipped Compared to base
index.css 29.17 KB 27.91 KB 3.54 KB 🔴 ⬆ 0.54 KB
metadata.json 14.56 KB - - 🔴 ⬆ 0.30 KB
* Size is the sum of all main files for packages in the library.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

Copy link
Contributor

github-actions bot commented May 19, 2025

🚀 Deployed on https://pr-3792--spectrum-css.netlify.app

@aramos-adobe aramos-adobe force-pushed the aramos-adobe/css1065-picker-markup-followup branch from d7c1ead to e519171 Compare May 19, 2025 22:53
@aramos-adobe aramos-adobe self-assigned this May 20, 2025
@aramos-adobe aramos-adobe added size-5 L ~30-42hrs; lots of effort or complexity, most of a sprint needed to complete. ready-for-review S2 Spectrum 2 labels May 20, 2025
@aramos-adobe aramos-adobe marked this pull request as ready for review May 20, 2025 22:06
@aramos-adobe aramos-adobe changed the title Aramos-adobe/css1065-picker-markup-followup feat(picker): refactoring template markup, testing token passthroughs May 20, 2025
Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's some style fixes that need to be addressed, specifically for the quiet variants. I left a thought about probably reimplementing the isQuiet arg getting passed to Picker() (not Template()). We'll also need to double check the side+quiet variant since the text alignment is pretty wonky:

This PR preview:
Screenshot 2025-05-23 at 11 39 17 AM

The table migration preview:
Screenshot 2025-05-23 at 11 39 10 AM

@marissahuysentruyt
Copy link
Collaborator

@aramos-adobe Would you be open to adding a test case where we check side + quiet pickers? That's the controls I used to find the text alignment issue.

Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking pretty good. My comments are mainly organizational suggestions, but there are some quiet spacing tokens that were removed, that I believe need to be added back in.

However, I'm a little puzzles with WHCM, and didn't dig too much into them. Testing on AssitivLabs, I'm seeing a double border around the component. I'm assuming this has to do with changing from .spectrum-Picker to .spectrum-Picker-button?

Screenshot 2025-05-29 at 9 53 51 AM

The disabled picker borders are getting cut off, so there might be some exploration needed there. I'm thinking if we fix the double borders first, the disabled cut off borders will probably fix themselves.

Screenshot 2025-05-29 at 9 55 38 AM

Is the chevron for a loading picker supposed to be disabled? It looks like it was before, but I don't actually know. It doesn't really look like that in the token specs, so I'm actually inclined to keep your changes. However, it does make sense to disable that chevron, since a user can't open the picker while it's loading...thoughts?

before:
Screenshot 2025-05-29 at 9 57 11 AM

after:
Screenshot 2025-05-29 at 9 57 04 AM

@@ -0,0 +1,16 @@
---
"@spectrum-css/picker": major
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is on the spectrum-two branch. I'm not certain how we're handling the changesets, so this is just a question for and about the future. When we do finally merge spectrum-two into main, do you know yet how we're going to handle this "major" change, AND the S2 picker migration "major" change? Are they going to get lumped together, and picker will get bumped only 1 version number, or are they going to be separated so that picker actually gets 2 version bumps?

This isn't really a question related to your work, I agree that these are breaking changes. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marissahuysentruyt Can this be a patch? I'm not sure how it works but hopefully that doesn't bump the version number

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's small enough to be a patch, personally. Maybe Cassondra or Patrick have a preference? I mean....it's a breaking/major change from the last iteration of the picker. That picker however, isn't available to consumers though.

The changesets stuff trips me up a bunch. If it makes you feel better, when we broke the dialog migration up, I added 2 changesets both marked major. I had the same question then!! 😆

Copy link
Collaborator

@castastrophe castastrophe Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can (and probably will) fuss with the changelog manually for this kind of release when the time comes, so I'm not worried about semver, per say. At this point, I am thinking about what impact changes might have on the SWC project. Would they require significant refactoring to support these changes? Then yeah, it probably is a major from that perspective.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Such a great clarification and I so appreciate y'all asking it! Can we surface this in the team chat as well to make sure we're all in agreement?)

Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things are looking really great! I'm curious about doing a manual Chromatic run for this branch.

My only changes I'd like to see before I approve is some small updates to the changeset! Nice work on this.

@@ -0,0 +1,16 @@
---
"@spectrum-css/picker": major
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's small enough to be a patch, personally. Maybe Cassondra or Patrick have a preference? I mean....it's a breaking/major change from the last iteration of the picker. That picker however, isn't available to consumers though.

The changesets stuff trips me up a bunch. If it makes you feel better, when we broke the dialog migration up, I added 2 changesets both marked major. I had the same question then!! 😆

Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is looking good! Since Cassondra is working on the POC for web components, this might be a good PR to have her look at. To me, it more closely matches the markup for the current sp-picker, but I don't have a good enough understanding of the reason the SWC popover is in the shadow root, and if we've introduced anything that really makes it hard for them to consume the CSS.

Overall, this PR does what the ticket says- it adds the t-shirt sized spacing between the picker and the popover, and (at least to me) more closely aligns our template markup, with SWC's sp-picker markup. 👍

@aramos-adobe aramos-adobe requested a review from castastrophe June 2, 2025 20:27
@castastrophe castastrophe merged commit 032001b into spectrum-two Jun 5, 2025
12 checks passed
@castastrophe castastrophe deleted the aramos-adobe/css1065-picker-markup-followup branch June 5, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review S2 Spectrum 2 size-5 L ~30-42hrs; lots of effort or complexity, most of a sprint needed to complete.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants