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

feat(popover): migrate s2 popover #3365

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

Conversation

marissahuysentruyt
Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt commented Nov 4, 2024

Description

Welcome to the new and improved S2 popover! 🥳

This PR updates tokens used in the popover component. The work includes new S2 tokens specifically for colors, padding and the border radius for popover. There is also a transparent border in light mode and a visible border in dark mode.

There are several components that have popover as a subcomponent. Those were updated with just enough additional code to make them "work." Coachmark and picker did have some additional CSS needs, particularly relating to the new popover corner rounding, and the new bottom-start positioning.

Popover Mods

Some mods have been renamed to match their new token names, or better reflect their purposes:

Old mod name New mod name
--mod-popover-content-area-spacing-vertical --mod-popover-content-area-spacing
--mod-popover-shadow-blur --mod-popover-drop-shadow-blur
--mod-popover-shadow-color --mod-popover-drop-shadow-color
--mod-popover-shadow-horizontal --mod-popover-drop-shadow-x
--mod-popover-shadow-vertical --mod-popover-drop-shadow-y

Notes

  • the background color and the border radius of the menu items is a known bug. It will be addressed in a separate branch.
  • there's a few coach mark questions that are still outstanding as well, including the needed drop shadow on the action menu popover (css-1066), and the padding (as noted in a few comments).
  • the picker 's popover styling is a known issue. I attempted to implement something like:
    /* popover passthroughs */
    --mod-popover-animation-distance: var(--spectrum-picker-spacing-picker-to-popover);

but the cascade doesn't quite work because of the markup differences. CSS-1065 captures some of the thoughts and issues, and Josh brought up some good questions/context in his comment below in regards to nesting elements and SWC.

Designs

S2 Popover Token specs
S2 / Desktop Popover

Jira

CSS-615

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

  • Pull down the branch or use the deploy preview
  • Visit the popover storybook. Verify all stories from main appear on the docs page. No changes should have been made to popover positions or tip placements.
  • The default popover matches the s2 popover specs.
  • Verify the action button trigger and popover menu items are accessible via keyboard.
  • Create various combinations of the popover to verify combos are considered in the CSS:
    • mobile vs desktop
    • light vs dark mode (the border color/transparency should change in dark mode)
    • popover positioning and tip placement
  • Verify new tokens are used:
    • popover-border-color (see the comment in index.css)
    • popover-border-opacity
    • drop-shadow-elevated-color
    • drop-shadow-elevated-x
    • drop-shadow-elevated-y
    • drop-shadow-elevated-blur
  • Verify updated tokens are used:
    • corner-radius-large-default
    • popover-edge-to-content-area (popover-top-to-content-area was removed from tokens)
    • border-width-100
    • background-layer-2-color (it may not be pointing to gray-25 as intended, but should once we make the full change to S2 tokens)
  • Chromatic coverage continues to maintain test templates, and does not have additional variations/test scenarios.
  • Action bar, action menu, coach mark, combobox, contextual help, date picker, menu (specifically the "submenu in popover" story), and picker (which all call for a popover component) look acceptable. There may be additional style issues to handle during those components' migrations, as opposed to this PR.

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

Before:
Screenshot 2024-11-06 at 5 16 11 PM

After:
Screenshot 2024-11-06 at 5 16 28 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 Nov 4, 2024

🦋 Changeset detected

Latest commit: 5134bf8

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

This PR includes changesets to release 3 packages
Name Type
@spectrum-css/picker Patch
@spectrum-css/popover Major
@spectrum-css/coachmark Minor

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

Copy link
Contributor

github-actions bot commented Nov 4, 2024

File metrics

Summary

Total size: 2.23 MB*
Total change (Δ): 🔴 ⬆ 0.53 KB (0.02%)

Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.

Package Size Δ
coachmark 5.48 KB 🔴 ⬆ < 0.01 KB
picker 28.63 KB 🔴 ⬆ 0.03 KB
popover 16.36 KB 🔴 ⬆ 0.28 KB

Details

coachmark

Filename Head Compared to base
index.css 5.48 KB 🔴 ⬆ < 0.01 KB (0.02%)
metadata.json 3.20 KB 🔴 ⬆ < 0.01 KB (0.03%)

picker

Filename Head Compared to base
index.css 28.63 KB 🔴 ⬆ 0.03 KB (0.10%)
metadata.json 14.22 KB 🔴 ⬆ 0.02 KB (0.17%)

popover

Filename Head Compared to base
index.css 16.36 KB 🔴 ⬆ 0.28 KB (1.71%)
metadata.json 8.10 KB 🔴 ⬆ 0.19 KB (2.33%)
* Size determined by adding together the size of the main file for all packages in the library.
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

@marissahuysentruyt marissahuysentruyt self-assigned this Nov 5, 2024
@marissahuysentruyt marissahuysentruyt added wip This is a work in progress, don't judge. do not merge A flag for a branch indicating it should not be merged. skip_vrt Add to a PR to skip running VRT (but still pass the action) S2 Spectrum 2 labels Nov 5, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 2024

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

@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-615-s2-popover branch from c982e9c to d9214ec Compare November 6, 2024 21:09
@marissahuysentruyt marissahuysentruyt marked this pull request as ready for review November 6, 2024 22:14
@marissahuysentruyt marissahuysentruyt added ready-for-review and removed wip This is a work in progress, don't judge. do not merge A flag for a branch indicating it should not be merged. labels Nov 6, 2024
@marissahuysentruyt marissahuysentruyt marked this pull request as draft November 6, 2024 22:18
@marissahuysentruyt marissahuysentruyt added wip This is a work in progress, don't judge. and removed ready-for-review labels Nov 6, 2024
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-615-s2-popover branch 3 times, most recently from 9eacd5d to b2e341b Compare November 8, 2024 18:06
@castastrophe castastrophe force-pushed the spectrum-two branch 3 times, most recently from cdb180d to 27d01df Compare December 4, 2024 14:54
@castastrophe castastrophe force-pushed the spectrum-two branch 6 times, most recently from fc916f1 to 9d7f088 Compare December 29, 2024 19:50
@marissahuysentruyt marissahuysentruyt added wip This is a work in progress, don't judge. and removed ready-for-review labels Jan 2, 2025
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-615-s2-popover branch from 3c6ebd8 to cc7713e Compare January 10, 2025 20:22
isOpen: isOpen && !isDisabled && !isLoading,
withTip: false,
position: "bottom",
position: "bottom-start",
Copy link
Collaborator Author

@marissahuysentruyt marissahuysentruyt Jan 13, 2025

Choose a reason for hiding this comment

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

bottom-start is from main & s2-foundations-redux. There's not explicit direction on the popover's positioning within picker that I found, but I don't think I see an issue with this change. Combobox, action menu, contextual help, date picker all use bottom-start.

The change here I thought then required the CSS selector changes, so if we're not cool with that right now, I'm happy to revert if there are any concerns.

--mod-popover-corner-radius: var(--spectrum-corner-radius-100);
--mod-popover-content-area-spacing-vertical: 0;
--mod-popover-corner-radius: var(--spectrum-corner-radius-large-default)
--mod-popover-content-area-spacing: 0;
Copy link
Collaborator Author

@marissahuysentruyt marissahuysentruyt Jan 13, 2025

Choose a reason for hiding this comment

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

I updated this mod name because I changed popover-content-area-spacing in the popover CSS- there's now padding on all sides of popover instead of just on the top & bottom. However, I am unsure if this is actually the correct styling for the popovers in coachmark. Is this something to address in the coachmark PR #3412? Regardless, we do have this captured in CSS-1067

With the new padding in Popover (especially noticeable in the action menu popover), which means removing --mod-popover-content-area-spacing completely.
Screenshot 2025-01-13 at 10 52 04 AM

Keeping --mod-popover-content-area-spacing: 0, which results in no padding
Screenshot 2025-01-13 at 10 51 55 AM

We might need something like this:
padding: var(--mod-popover-content-area-spacing, var(--spectrum-popover-content-area-spacing)) 0; to mimic the old popover vertical padding. What do y'all think?

@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-615-s2-popover branch 3 times, most recently from 7d6ce16 to 1c99e9c Compare January 13, 2025 17:11
@marissahuysentruyt marissahuysentruyt added ready-for-review and removed wip This is a work in progress, don't judge. labels Jan 13, 2025
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-615-s2-popover branch from 1c99e9c to ec1c97f Compare January 16, 2025 17:30
@castastrophe castastrophe force-pushed the spectrum-two branch 4 times, most recently from 7e783b6 to e3585cd Compare January 22, 2025 17:44
- new tokens and token values used for popover
- create changeset
- rebuild metadata.json
- adjust popoverWidth and popoverHeight args to accommodate new padding
- update test file with new popoverWidth and popoverHeight
- update the border radius of the popover nested in coachmark to match
S2 popover specs
- update popover `--mod-popover-content-area-spacing` variable name
(previously --mod-popover-content-area-spacing-vertical)
- rebuild metadata.json
- with the new default position for popover, the selector class for the
popover in picker also needed to be updated. (--bottom-start)
- create changeset
- rebuild metadata.json
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-615-s2-popover branch from ec1c97f to 5134bf8 Compare January 24, 2025 16:51
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 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