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(tooltip): S2 migration #2743

Merged
merged 1 commit into from
Jul 19, 2024
Merged

Conversation

mdt2
Copy link
Collaborator

@mdt2 mdt2 commented May 9, 2024

Description

This migration includes updated colors, rounding, a bigger tip, and the removal of variants (only neutral is available in Spectrum 2). As a result of the deprecation of variants, icons have also been removed.

The redesign of the tip, specifically the rounding, required a reworking of how we use clip-path and transform.

Some custom property mods have been removed:

  • --mod-tooltip-background-color-informative
  • --mod-tooltip-background-color-negative
  • --mod-tooltip-background-color-positive
  • --mod-tooltip-icon-spacing-block-start
  • --mod-tooltip-icon-spacing-inline-end
  • --mod-tooltip-icon-spacing-inline-start
  • --mod-tooltip-icon-width

And one mod has been added:

  • --mod-tooltip-tip-corner-radius

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

  • Design review (@mdt2)
    • Specifically check on the new distance of tooltip from edge. This needed adjusted because of the new corner rounding. It looks funky when the tooltip text is only one line.
  • Check out Tooltip in Storybook, specifically the testing preview will be helpful. The variants should align with the token changes in the design spec (@rise-erpelding)
  • Now turn on RTL. All the tips should be in the correct place. (@rise-erpelding)
  • Any controls for the deprecated variants (informative, positive, negative) have been removed from storybook (@rise-erpelding)
  • Now let's spin up the docs site to check that the "show on hover" functionality is still looking good. You'll have to do this locally because of the difference in tokens package:
    • First update the site/package.json tokens version to be >=14.0.0-next.7
    • Then you can run a yarn install
    • And finally a yarn dev
    • Check on that hover functionality and make sure it's looking good
  • And still in the docs site, turn on RTL and make sure the hover functionality looks good there too

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

Screen Shot 2024-05-09 at 3 29 34 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 May 9, 2024

🦋 Changeset detected

Latest commit: 47676be

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

This PR includes changesets to release 2 packages
Name Type
@spectrum-css/tooltip Major
@spectrum-css/steplist 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

Copy link
Contributor

github-actions bot commented May 9, 2024

File metrics

Summary

Total size: 4.22 MB*
Total change (Δ): ⬇ 11.78 KB (-0.27%)

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

Package Size Δ
tooltip 30.64 KB ⬇ 3.39 KB
tokens 210.08 KB ⬆ 0.14 KB

Details

tooltip

File Head Base Δ
index-base.css 30.38 KB 33.77 KB ⬇ 3.39 KB (-10.05%)
index-theme.css 0.86 KB 0.86 KB -
index-vars.css 30.64 KB 34.03 KB ⬇ 3.39 KB (-9.97%)
index.css 30.64 KB 34.03 KB ⬇ 3.39 KB (-9.97%)
metadata.json 22.17 KB 24.04 KB ⬇ 1.87 KB (-7.79%)
themes/express.css 0.73 KB 0.73 KB -
themes/spectrum.css 0.73 KB 0.73 KB -

tokens

File Head Base Δ
css/dark-vars.css 36.72 KB 36.72 KB -
css/express/custom-dark-vars.css 0.59 KB 0.59 KB -
css/express/custom-darkest-vars.css 0.59 KB 0.59 KB -
css/express/custom-large-vars.css 0.50 KB 0.50 KB -
css/express/custom-light-vars.css 0.63 KB 0.63 KB -
css/express/custom-medium-vars.css 0.48 KB 0.48 KB -
css/express/custom-vars.css 0.04 KB 0.04 KB -
css/global-vars.css 54.79 KB 54.79 KB -
css/large-vars.css 28.77 KB 28.77 KB -
css/light-vars.css 36.71 KB 36.71 KB -
css/medium-vars.css 28.70 KB 28.70 KB -
css/spectrum/custom-dark-vars.css 3.40 KB 3.40 KB -
css/spectrum/custom-darkest-vars.css 3.40 KB 3.40 KB -
css/spectrum/custom-large-vars.css 4.76 KB 4.68 KB ⬆ 0.08 KB (1.73%)
css/spectrum/custom-light-vars.css 3.40 KB 3.40 KB -
css/spectrum/custom-medium-vars.css 4.98 KB 4.92 KB ⬆ 0.06 KB (1.15%)
css/spectrum/custom-vars.css 2.18 KB 2.18 KB -
index.css 210.08 KB 209.95 KB ⬆ 0.14 KB (0.07%)
* 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.

Copy link
Contributor

github-actions bot commented May 9, 2024

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

background-color: var(--highcontrast-tooltip-background-color-default, var(--mod-tooltip-background-color-default, var(--spectrum-tooltip-background-color-default)));

/* Default: Pointing down ▽ */
clip-path: polygon(0 calc(0% - var(--mod-tooltip-tip-antialiasing-inset, var(--spectrum-tooltip-tip-antialiasing-inset))), 100% var(--mod-tooltip-tip-height-percentage, var(--spectrum-tooltip-tip-height-percentage)), calc(0% - var(--mod-tooltip-tip-antialiasing-inset, var(--spectrum-tooltip-tip-antialiasing-inset))) 100%);
Copy link
Collaborator Author

@mdt2 mdt2 May 9, 2024

Choose a reason for hiding this comment

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

The problem with the previous clip-path was that I couldn't apply a border-radius to it when there was a 50% point. So I adjusted the sizing of the square (see above) and the clip-path points to be able to apply the new border-radius to the tip.

This change also has a little bonus that we don't have to redefine the clip-path for the different placements, we just have to adjust the transform: rotate() value ✨

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 looks great and I really appreciated the clear validation instructions! All of those things look good and I'm happy to approve, but I have some outstanding questions, one above about the tip size being just slightly off the design for large platform scale, but I also noticed if I look closely at the tip (I changed the color to make it easy to see--and this is Chrome which is more obvious than Firefox) it almost looks like the rotation is slightly off (I think maybe by 1 degree?), which is weird because why would you need to rotate it -46deg instead of -45deg? 🤷‍♀️ Totally something we could explore more or talk about or reason through in case there's some weird logical reason for it!
image

components/tooltip/index.css Outdated Show resolved Hide resolved
Copy link
Collaborator

@jawinn jawinn left a comment

Choose a reason for hiding this comment

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

One thing I noticed was that the tip looks a little overlapped in high contrast mode. Is that something that is possible to adjust?
Screenshot 2024-05-14 at 12 38 06 PM

components/tooltip/index.css Outdated Show resolved Hide resolved
components/tooltip/index.css Show resolved Hide resolved
components/tooltip/index.css Outdated Show resolved Hide resolved
@mdt2
Copy link
Collaborator Author

mdt2 commented May 15, 2024

@rise-erpelding great callout about the strange rotation. This was caused by trying to account for antialiasing in the clip-path. When I moved that to the positioning properties instead, this resolved 🎉

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.

I just took a quick look at this one again and it looks like the tip issues previously noted are sorted out now! Nice work! If there are any further adjustments based on design feedback, I'm happy to take another look, but for now, I'm giving it my approval!

@rise-erpelding rise-erpelding force-pushed the mdt2/css-717-s2-tooltip branch 3 times, most recently from 834edcf to 0135f5b Compare June 13, 2024 20:04
Comment on lines +165 to +170
<div>
${Template({
...args,
placement: option,
})}
</div>
Copy link
Collaborator

@rise-erpelding rise-erpelding Jun 13, 2024

Choose a reason for hiding this comment

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

Wrapping the Template in a <div> solves the issue that was happening here where the Tooltip starts expanding to fill the container:
image (1)

@@ -15,6 +15,7 @@ governing permissions and limitations under the License.

.spectrum-Tooltip {
--spectrum-tooltip-animation-duration: var(--spectrum-animation-duration-100);
--spectrum-tooltip-animation-distance: var(--spectrum-spacing-75);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Design spec says spacing-75, I'll double-check with design and revert if needed but it doesn't sound like it differs for the large platform size.

--spectrum-tooltip-line-height: var(--spectrum-line-height-100);

/* @todo set line-height using font size specific line-height tokens when they are finalized along with the new variable font. */
--spectrum-tooltip-line-height: 1.2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is similar to button where the line-height token causes the overall height of the tooltip to be larger than the height token, so we need to adjust the line-height manually to make it work.

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.

@rise-erpelding Thanks for taking this on! Left a few questions for you, mainly getting myself up to speed on a few of the changes.

The line-height stuff: I left a question about it, but there's a spot in the Figma file that looks like maayyybe this is what design was seeing and we're trying to fix with the hardcoded 1.2. There's a little comparison chart. Is that correct?

components/tooltip/index.css Show resolved Hide resolved
components/tooltip/index.css Show resolved Hide resolved
components/tooltip/index.css Show resolved Hide resolved
@rise-erpelding rise-erpelding merged commit 5a0ce6e into spectrum-two Jul 19, 2024
11 checks passed
@rise-erpelding rise-erpelding deleted the mdt2/css-717-s2-tooltip branch July 19, 2024 19:06
@github-actions github-actions bot mentioned this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants