Skip to content

feat(combobox): adding new s2 migration #3683

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

Open
wants to merge 34 commits into
base: spectrum-two
Choose a base branch
from

Conversation

aramos-adobe
Copy link
Contributor

@aramos-adobe aramos-adobe commented Apr 23, 2025

Combobox S2 Migration

The new combo box is coming in with more pronounced corner radius, thicker outline, and the use of the infield button nested inside. The quiet styling has also been deprecated.

New tokens

--spectrum-combobox-font-weight
--spectrum-combobox-line-height-cjk
--spectrum-combobox-spacing-alert-icon-to-text
--spectrum-combobox-spacing-to-help-text

New mods

--mod-combobox-line-height-cjk
--mod-combobox-popover-animation-distance
--mod-combobox-spacing-alert-icon-to-text
--mod-combobox-spacing-to-help-text
--mod-combobox-textfield-background-color

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

  • Combobox matches the token spec
  • Layout
  • Icons
  • Embedded components
  • Colors
  • Typography

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

S1

Screenshot 2025-05-06 at 1 27 23 PM

S2

Screenshot 2025-05-06 at 1 26 55 PM

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 Apr 23, 2025

🦋 Changeset detected

Latest commit: cfd51d2

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/combobox 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 self-assigned this Apr 23, 2025
@aramos-adobe aramos-adobe marked this pull request as draft April 23, 2025 16:30
@aramos-adobe aramos-adobe added the S2 Spectrum 2 label Apr 23, 2025
Base automatically changed from aramos-adobe/css770-infield-button-s2-migration to spectrum-two April 24, 2025 15:58
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

markdownlint-fix

[markdownlint-fix] reported by reviewdog 🐶

"--spectrum-gray-50",
"--spectrum-gray-700",
"--spectrum-gray-800",


[markdownlint-fix] reported by reviewdog 🐶

"--spectrum-negative-color-1100",


[markdownlint-fix] reported by reviewdog 🐶

"--spectrum-neutral-background-color-selected-default",
"--spectrum-neutral-background-color-selected-down",
"--spectrum-neutral-background-color-selected-hover",
"--spectrum-neutral-background-color-selected-key-focus",


[markdownlint-fix] reported by reviewdog 🐶

"--spectrum-text-to-control-100",


[markdownlint-fix] reported by reviewdog 🐶

"--highcontrast-checkbox-color-hover",


[markdownlint-fix] reported by reviewdog 🐶

"--highcontrast-checkbox-highlight-color-focus",

Copy link
Contributor

github-actions bot commented Apr 24, 2025

File metrics

Summary

Total size: 1.40 MB*
No change in file sizes

Package Size Minified Gzipped
combobox 25.82 KB 24.81 KB 2.98 KB
helptext 7.05 KB 6.75 KB 1.15 KB

File change details

combobox

Filename Head Minified Gzipped Compared to base
index.css 25.82 KB 24.81 KB 2.98 KB 🟢 ⬇ 2.25 KB
metadata.json 15.59 KB - - 🟢 ⬇ 0.28 KB

helptext

Filename Head Minified Gzipped Compared to base
index.css 7.05 KB 6.75 KB 1.15 KB 🔴 ⬆ 0.12 KB
metadata.json 3.87 KB - - 🔴 ⬆ 0.10 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 Apr 24, 2025

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

@aramos-adobe aramos-adobe force-pushed the aramos-adobe/css769-combox-s2-migration branch from a986db0 to ff02395 Compare April 24, 2025 20:26
@castastrophe castastrophe force-pushed the spectrum-two branch 3 times, most recently from 7e8269c to 4ce8d19 Compare May 5, 2025 21:18
@aramos-adobe aramos-adobe marked this pull request as ready for review May 6, 2025 18:14
@aramos-adobe aramos-adobe added ready-for-review size-5 L ~30-42hrs; lots of effort or complexity, most of a sprint needed to complete. run_vrt For use on PRs looking to kick off VRT labels May 6, 2025
@aramos-adobe aramos-adobe added skip_vrt Add to a PR to skip running VRT (but still pass the action) and removed run_vrt For use on PRs looking to kick off VRT labels May 6, 2025
@rise-erpelding rise-erpelding self-requested a review May 14, 2025 17:00
Copy link
Collaborator

@rise-erpelding rise-erpelding 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 an excellent start! I left several comments in the code, but here are some other considerations that didn't fit:

  • I did notice that there were autocomplete colors in the design spec, even though we can't (or shouldn't) implement any autocomplete functionality here, we probably should make sure we have the autocomplete styles in here, even if just with a selector like .spectrum-Combobox-input[autocomplete]. It looks like the textfield template has an autocomplete attribute that can be placed on the textfield input, so we could probably pass that arg to textfield from combobox once it's set up, and also wire up a Storybook control for it.
  • I think there might be a tiny design bug in the block spacing for the progress circle, I'll Slack you so that I can send screenshots and explain. This wasn't a part of the code you touched. (In fact there were several things I called out here that aren't related to changes you made but seemed like they've been wrong for awhile.)
  • Last thing: I saw this interaction error in Storybook, I don't think it's a huge issue, could be a follow up ticket if anything? (There is a role="presentation" so I'm not sure what it's complaining about)
    image

Copy link
Collaborator

@saashapina saashapina 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 great! I don't have access to the Figma Token Spec to give this a full review yet but I did just have a couple questions for myself. I also had my build fail in my PR after I rebased with the main spectrum-two branch. It looks it was missing a few metadata.json files.


### New mods

`--mod-combobox-line-height-cjk`
Copy link
Collaborator

Choose a reason for hiding this comment

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

This question is for future me, @castastrophe had mentioned to me that we were discontinuing use of mods. Are certain there scenarios like this that we will continue to support them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@saashapina @castastrophe I'm not entirely sure - I think that might be a web component related thing. But mods are still helpful for passthroughs between each component.

fieldLabelText: "Select location",
value: "Ballard",
};
Default.args = {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also a question for my future reference, do we still need to define an empty object here if there are no args?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@saashapina I don't need this at all actually! I can remove it

Copy link
Collaborator

@rise-erpelding rise-erpelding left a comment

Choose a reason for hiding this comment

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

Really nice work addressing the feedback from before! I have a few (15? 😬 ) other comments. I definitely see that I've pointed out several things that aren't new in this migration but existing issues from before that hopefully we can improve going forward.

isDisabled,
isReadOnly,
value,
...args,
...passthrough,
}, context),
content,
popoverWidth: size === "s" ? 140 : size === "l" ? 191 : size === "xl" ? 192 : 166, // default value is "m"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's valid that you're removing this but I looked into this for a bit and I'm having a hard time understanding why it was here to begin with. It looks like popoverWidth is used to control the width of the popover and align it with the popover width, but only if it's in certain popover positions. I would have thought it'd control the popover's width in combobox, but it seems like the popover position is such that it doesn't need the width (seems like we only use it in bottom-start position, which doesn't look at the width).

Comment on lines +95 to +98
autocomplete: {
table: {
disable: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to access autocomplete styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even with &:autofill selector added the styles won't change.

}
}

.spectrum-Combobox {
position: relative;
display: inline-flex;
flex-flow: row nowrap;
display: inline-grid;

inline-size: var(--mod-combobox-inline-size, var(--spectrum-combobox-inline-size));
min-inline-size: var(--mod-combobox-min-inline-size, var(--spectrum-combobox-min-inline-size));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here's another thing about combobox that I'm wondering about that I sort of touched on in another comment: Should the min-inline-size be set on .spectrum-Combobox or on .spectrum-Combobox-input? When we have a side label the input tends to shrink a lot, in this case it's about 78.5px. Since the minimum width token is a multiplier (2.5 * the height, which is 32px), it looks like for this particular size the combobox should be a minimum of 80px. Which it is, if we're talking about the field label + input width, but the input is smaller. I know this is how it was before, but was that what was intended?

image image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rise-erpelding Looking at the component a little closer in Figma, it looks like side label and the input are half of the combobox in width.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aramos-adobe I placed a min inline size of 50% for both label and the content (parent containing the inputs). I have seen any weird movements yet in the button. I did place a position: relative on the .spectrum-Combobox-content to keep the button at the end of it.

Copy link
Collaborator

@saashapina saashapina left a comment

Choose a reason for hiding this comment

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

This looks really close! I had few last comments that don't seem directly related to these S2 migration changes but I thought I'd point out just in case.

}

/* TEXT INPUT */
.spectrum-Combobox-input {
padding-block-start: calc(var(--mod-combobox-spacing-block-start-edge-to-text, var(--spectrum-combobox-spacing-block-start-edge-to-text)) - var(--mod-combobox-border-width, var(--spectrum-combobox-border-width)));
padding-block-end: calc(var(--mod-combobox-spacing-block-end-edge-to-text, var(--spectrum-combobox-spacing-block-end-edge-to-text)) - var(--mod-combobox-border-width, var(--spectrum-combobox-border-width)));
background-color: var(--highcontrast-combobox-background-color-default, var(--mod-combobox-textfield-background-color, var(--spectrum-combobox-background-color-default)));
padding-inline-start: calc(var(--mod-combobox-spacing-inline-start-edge-to-text, var(--spectrum-combobox-spacing-inline-start-edge-to-text)) - var(--mod-combobox-border-width, var(--spectrum-combobox-border-width)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason why we subtract the border-width here? It looks like inline edge to start should start at the inside of the border instead of outside of it.

Screenshot 2025-05-22 at 5 49 59 PM

Screenshot 2025-05-22 at 5 55 54 PM

Firefox
Screenshot 2025-05-22 at 6 00 08 PM

}

const popoverHeight = size === "s" ? 106 : size === "l" ? 170 : size === "xl" ? 229 : 142; // default value is "m"
const adjustedPopoverHeight = showFieldLabel ? popoverHeight : popoverHeight + 32; // Subtract label height when no label

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also noticed on the invalid tests when the combobox is expanded on size small there is a little bit of overlap with the fields below it, I'm not sure if its related to these changes or if this was an existing bug.
Medium
Screenshot 2025-05-22 at 6 14 48 PM
Large
Screenshot 2025-05-22 at 6 24 40 PM

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. skip_vrt Add to a PR to skip running VRT (but still pass the action)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy