Skip to content
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

[WB-1847] Dropdown: Update SelectOpener to match Design specs. #2438

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

jandrade
Copy link
Member

Summary:

  • Updated SelectOpener to match design specs.
  • Also converted color tokens to use semanticColor tokens.

Figma: https://www.figma.com/design/VbVu3h2BpBhH80niq101MHHE/%F0%9F%92%A0-Main-Components?node-id=13693-11133&t=W16iu9a1X5vqz5ez-4

NOTE: The light version was removed on a separate PR, so those design specs are not included here anymore.

Issue: https://khanacademy.atlassian.net/browse/WB-1847

Test plan:

Verify that the SelectOpener component looks as expected in the All Variants
stories.

Juan Andrade added 2 commits January 21, 2025 18:33
…nternal component) from `Dropdown` to match Design specs. Also converts `color` tokens to use `semanticColor` tokens.
@jandrade jandrade self-assigned this Jan 21, 2025
Copy link

changeset-bot bot commented Jan 21, 2025

🦋 Changeset detected

Latest commit: b749fa9

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

This PR includes changesets to release 2 packages
Name Type
@khanacademy/wonder-blocks-dropdown Patch
@khanacademy/wonder-blocks-birthday-picker Patch

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

@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/six-jobs-promise.md, packages/wonder-blocks-dropdown/src/components/select-opener.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@khan-actions-bot khan-actions-bot requested a review from a team January 21, 2025 23:37
Copy link
Contributor

github-actions bot commented Jan 21, 2025

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (7980324) and published all packages with changesets to npm.

You can install the packages in webapp by running:

./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2438"

Packages can also be installed manually by running:

yarn add @khanacademy/wonder-blocks-<package-name>@PR2438

Copy link
Contributor

github-actions bot commented Jan 21, 2025

Size Change: +170 B (+0.17%)

Total Size: 97.8 kB

Filename Size Change
packages/wonder-blocks-dropdown/dist/es/index.js 18.9 kB +170 B (+0.91%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 3.77 kB
packages/wonder-blocks-banner/dist/es/index.js 1.53 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.77 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 887 B
packages/wonder-blocks-button/dist/es/index.js 4.12 kB
packages/wonder-blocks-cell/dist/es/index.js 2.01 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.06 kB
packages/wonder-blocks-core/dist/es/index.js 2.9 kB
packages/wonder-blocks-data/dist/es/index.js 6.24 kB
packages/wonder-blocks-form/dist/es/index.js 5.87 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-icon-button/dist/es/index.js 2.95 kB
packages/wonder-blocks-icon/dist/es/index.js 871 B
packages/wonder-blocks-labeled-field/dist/es/index.js 1.84 kB
packages/wonder-blocks-layout/dist/es/index.js 1.82 kB
packages/wonder-blocks-link/dist/es/index.js 2.28 kB
packages/wonder-blocks-modal/dist/es/index.js 5.42 kB
packages/wonder-blocks-pill/dist/es/index.js 1.65 kB
packages/wonder-blocks-popover/dist/es/index.js 4.85 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.52 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.34 kB
packages/wonder-blocks-switch/dist/es/index.js 1.92 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.74 kB
packages/wonder-blocks-testing/dist/es/index.js 1.07 kB
packages/wonder-blocks-theming/dist/es/index.js 693 B
packages/wonder-blocks-timing/dist/es/index.js 1.8 kB
packages/wonder-blocks-tokens/dist/es/index.js 2.52 kB
packages/wonder-blocks-toolbar/dist/es/index.js 905 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.99 kB
packages/wonder-blocks-typography/dist/es/index.js 1.23 kB

compressed-size-action

@jandrade
Copy link
Member Author

This is the remaining work to replace this PR: #2422

Copy link
Contributor

github-actions bot commented Jan 21, 2025

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-wsroulwyvh.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 378
Tests with visual changes 0
Total stories 520
Inherited (not captured) snapshots [TurboSnap] 0
Tests on the build 378

borderWidth: tokens.border.width.thin,
paddingLeft: adjustedPaddingLeft,
paddingRight: adjustedPaddingRight,
const pressStyling = {
Copy link
Member Author

Choose a reason for hiding this comment

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

@marcysutton I've updated the variable name to match the new convention: press.

Copy link
Member

Choose a reason for hiding this comment

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

Oh nice, that looks consistent with the convention of state + "Styling"! The usage I was referencing in my prior comment is actually down at the bottom of the file, where pressStyling is used: press: pressStyling. The press part is what I was curious about, since it differs from disabled in how we reference state!

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh I see! press is a new naming convention that we are using with Design. Wonder Blocks and Thunder Blocks are going to be updated soon to reflect that change as well to make it a bit more platform agnostic and match the other pseudo-states we currently define (default/rest, hover, focus). As for disabled, we are keeping it that way to keep it consistent with the disabled/aria-disabled HTML/ARIA attributes.

@jandrade jandrade requested a review from beaesguerra January 22, 2025 20:23
Copy link
Member

@beaesguerra beaesguerra left a comment

Choose a reason for hiding this comment

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

Left some comments on semantic token usage! Visual diffs look good, the comments you left in Chromatic were very helpful in reviewing, thank you!

borderWidth: tokens.border.width.thin,
paddingLeft: adjustedPaddingLeft,
paddingRight: adjustedPaddingRight,
outlineColor: error
Copy link
Member

Choose a reason for hiding this comment

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

Would this use the global outline semantic color token later on?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct! but for now we keep it separately as we want to continue using this approach in the current experience.

Comment on lines +242 to +244
outlineOffset: -border.width.thin,
outlineStyle: "solid",
outlineWidth: border.width.thin,
Copy link
Member

Choose a reason for hiding this comment

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

(for later): I wonder if we could use tokens for these values too! That would be an alternative way to share focus outline styles

Copy link
Member Author

Choose a reason for hiding this comment

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

do you mean something like semantic tokens? or global tokens?

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh I see, it would be global semantic tokens. Yeah, the short term goal will be this, but this will happen after completing the color migration.

Copy link
Member

Choose a reason for hiding this comment

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

Yes! Global semantic tokens for the focus outline styles!

? semanticColor.text.secondary
: semanticColor.action.outlined.progressive.press.foreground
: semanticColor.text.primary,
outlineColor: error
Copy link
Member

Choose a reason for hiding this comment

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

Would this also use the global focus outline token?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, yes! we'll have to see how the design specs are landed, but that's what we decided when we spoke about it.

? semanticColor.status.critical.background
: semanticColor.surface.primary,
borderColor: error
? semanticColor.status.critical.foreground
Copy link
Member

Choose a reason for hiding this comment

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

Should this be semanticColor.status.critical.border?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's defined using those tokens in Figma. The goal for the status category is to only use background and foreground. Once we have more alignment with the new theme, we are hoping to remove the border tokens from all actions.

Screenshot 2025-01-27 at 10 45 52 AM

color: placeholder
? tokens.color.offBlack64
: tokens.color.offBlack,
? semanticColor.text.secondary
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it would be worth having a separate semantic text color for placeholder. I'm updating the secondary text color to be fadedOffBlack72 for the subtitle in the Cell component. It's also currently used for the LabeledField description. It might be too dark for placeholder text!

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! I raised that point in Figma and we are good to go with this change (using 72 for placeholders).

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for confirming!

borderWidth: tokens.border.width.hairline,
paddingLeft: tokens.spacing.medium_16,
paddingRight: tokens.spacing.small_12,
? semanticColor.status.critical.foreground
Copy link
Member

Choose a reason for hiding this comment

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

Should this be semanticColor.status.critical.border?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same answer as the previous comment. To clarify this part a bit more. If we use status, it border and color will share foreground (most likely), and if we use action, then we can use separate tokens.

background: tokens.color.offWhite,
borderColor: tokens.color.offBlack16,
color: tokens.color.offBlack64,
background: semanticColor.action.disabled.secondary,
Copy link
Member

Choose a reason for hiding this comment

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

Should this be semanticColor.action.disabled.background?

Copy link
Member Author

Choose a reason for hiding this comment

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

We are also following the semantics defined in Figma here. Apologies for making these reviews hard, but we are in a point where things are changing quickly so we don't have all the patterns fully defined.

Screenshot 2025-01-27 at 10 58 09 AM

NOTE: IMO disabled should not be an action and maybe something else (e.g. status).

Copy link
Member

Choose a reason for hiding this comment

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

No worries, we're also in a transition phase so lots of different things to consider! My questions are mostly around if the semantic meanings apply for the use cases, thanks for answering my questions! 😄

Copy link
Member

@beaesguerra beaesguerra left a comment

Choose a reason for hiding this comment

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

Looks great! 🚀

@jandrade jandrade merged commit c774f7d into main Jan 27, 2025
14 checks passed
@jandrade jandrade deleted the semantic-dropdown-opener branch January 27, 2025 17:36
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (0de25cd) to head (b749fa9).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@     Coverage Diff      @@
##   main   #2438   +/-   ##
============================
============================

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0de25cd...b749fa9. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants