Skip to content

chore: spectrum-two fixes #3514

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

marissahuysentruyt
Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt commented Jan 21, 2025

Description

This PR reimplements some fixes for the spectrum-two branch after a rebase.

  1. Adds a missing variant = "neutral" default arg to the tooltip template. This should alleviate the errors on the docs page.

Before 🚫
Screenshot 2025-01-08 at 4 51 59 PM

After ✅
Screenshot 2025-01-08 at 4 51 36 PM

  1. An additional fix on the steplist docs page occurred since the WithTooltip story calls for the tooltip component. 🥳

Before 🚫
Screenshot 2025-01-22 at 10 20 01 AM

After ✅
Screenshot 2025-01-22 at 10 22 00 AM

  1. The calls to window.isChromatic have been removed. It also corrects the arg names for picker, in order for them to be properly passed to the popover used in the template and render the content. This should alleviate all errors and most of the missing content on the docs page. (additional styling and content changes will need to be addressed in a separate PR).

Before 🚫
Screenshot 2025-01-22 at 9 53 23 AM

After ✅
Screenshot 2025-01-22 at 10 04 48 AM

  1. An additional fix on the form docs page occurred since the examples we use contain the picker component. 🥳

Before 🚫
Screenshot 2025-01-22 at 9 53 35 AM

After ✅
Screenshot 2025-01-22 at 10 04 55 AM

  1. An additional fix on the tabs docs page occurred since the Overflow story calls for the picker component. 🥳

Before 🚫
Screenshot 2025-01-22 at 10 11 01 AM

After ✅
Screenshot 2025-01-22 at 10 11 33 AM

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 to run locally or use the deploy preview.
  • Visit the picker docs page.
  • Verify no errors referencing the variant is not defined appear in place of the WithTooltip story canvas. Each story step in the steplist should have a rendered tooltip with step number content.
  • Visit the form docs page.
  • Similarly to the picker docs, now errors should occur regarding window.isChromatic(). All form components should render with a closed picker component that displays the placeholder text.
  • Visit the tooltip docs page.
  • Verify there are no errors referencing variant is not defined. All tooltips should now display as expected.
  • Visit the tabs docs page.
  • Similarly to the picker docs, no errors should occur regarding window.isChromatic(). The overflow tabs components should render with a closed picker component that displays the first tab item's text & chevron.
  • Visit the steplist docs page.
  • Verify

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.
  • If my change impacts other components, I have tested to make sure they don't break.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented Jan 21, 2025

⚠️ No Changeset found

Latest commit: 392cb52

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Jan 21, 2025

File metrics

Summary

Total size: 2.23 MB*

🎉 No changes detected in any packages

* 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 changed the title Marissahuysentruyt/spectrum two context fixes chore: spectrum-two fixes Jan 21, 2025
@castastrophe castastrophe force-pushed the marissahuysentruyt/spectrum-two-context-fixes branch from 7099b51 to 7ec37a6 Compare January 21, 2025 19:52
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/spectrum-two-context-fixes branch from 7ec37a6 to db363d5 Compare January 21, 2025 22:20
Copy link
Contributor

github-actions bot commented Jan 21, 2025

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

@@ -97,7 +97,7 @@ export default {
},
isHovered,
isActive,
content: { table: { disable: true } },
popoverContent: { table: { disable: true } },
Copy link
Collaborator Author

@marissahuysentruyt marissahuysentruyt Jan 22, 2025

Choose a reason for hiding this comment

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

During the picker docs-to-storybook migration, we tried to clarify this picker control by calling it popoverContent. This is the content that gets passed to the popover component in the template.

Popover has its own content arg, so that's why you'll see the content: popoverContent assignment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Separately, there might be more that we can pull from the docs migration PR listed above. It looks like some of those additional controls/args (like currentValue, isHovered, showWorkflowIcon, and maybe some others) are missing currently. That could probably be figured out in a separate PR.

@@ -12,6 +12,7 @@ export const Template = ({
rootClass = "spectrum-Tooltip",
label,
placement,
variant = "neutral",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like the informative & negative tooltips got added back to Figma 11/18/24 (approximately). We'll have to create a card to implement the CSS styles and stories (for the docs page & controls)

variant: {
			name: "Variant",
			type: { name: "string" },
			table: {
				type: { summary: "string" },
				category: "Component",
			},
			options: ["neutral", "info", "negative"],
			control: "inline-radio",

tooltip migration PR: https://github.com/adobe/spectrum-css/pull/2743/files#diff-14d4b487bc2de8da9dccaef67bce6cccc92cbce28e2ac16912884edbce436cbc

Copy link
Collaborator

Choose a reason for hiding this comment

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

🙀 Good catch! Who knew those variants would come back again?

@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/spectrum-two-context-fixes branch 2 times, most recently from 8f25da7 to c038203 Compare January 22, 2025 16:05
Comment on lines -68 to 69
if (window.isChromatic()) return;
@click=${function() {
updateArgs({ isOpen: !isOpen });
}}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On main, this line is @click=${onclick}, and the onclick function was defined in the Popover call. This template is pretty different from main, so I plopped the function here for now.

Any thoughts or reservations on this?

Copy link
Member

Choose a reason for hiding this comment

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

Just a nit, but should we keep it formatted as an arrow function? ✨

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I know enough about why this part of the code is different between the branches/how Chromatic normally handles Picker, but it does work as is, and would work as an arrow function as well 🤷‍♀️

@marissahuysentruyt marissahuysentruyt self-assigned this Jan 22, 2025
@marissahuysentruyt marissahuysentruyt added S2 Spectrum 2 bug Results from a bug in the CSS implementation size-1 XS ~1-6hrs; nearly trivial, a few hours, could do more than one in a single day. labels Jan 22, 2025
@marissahuysentruyt marissahuysentruyt marked this pull request as ready for review January 22, 2025 16:17
Copy link
Member

@cdransf cdransf left a comment

Choose a reason for hiding this comment

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

Ran through the validation steps and the only error I encountered were due to missing theme css files (which is out of scope and — I believe — fixed on spectrum-two).

Comment on lines -68 to 69
if (window.isChromatic()) return;
@click=${function() {
updateArgs({ isOpen: !isOpen });
}}
Copy link
Member

Choose a reason for hiding this comment

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

Just a nit, but should we keep it formatted as an arrow function? ✨

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 works and fixes many of the other issues I was noticing in other components too!

This does a nice job preserving the changes from the picker migration in #2697 but keeps what we need to make things work! 🎉

Comment on lines -68 to 69
if (window.isChromatic()) return;
@click=${function() {
updateArgs({ isOpen: !isOpen });
}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I know enough about why this part of the code is different between the branches/how Chromatic normally handles Picker, but it does work as is, and would work as an arrow function as well 🤷‍♀️

@@ -12,6 +12,7 @@ export const Template = ({
rootClass = "spectrum-Tooltip",
label,
placement,
variant = "neutral",
Copy link
Collaborator

Choose a reason for hiding this comment

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

🙀 Good catch! Who knew those variants would come back again?

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component
- adds missing placeholder arg to template
- corrects content arg to popoverContent
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/spectrum-two-context-fixes branch from c038203 to 392cb52 Compare January 22, 2025 18:23
@marissahuysentruyt marissahuysentruyt merged commit f360c68 into spectrum-two Jan 22, 2025
11 checks passed
@marissahuysentruyt marissahuysentruyt deleted the marissahuysentruyt/spectrum-two-context-fixes branch January 22, 2025 18:40
castastrophe pushed a commit that referenced this pull request Feb 5, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
castastrophe pushed a commit that referenced this pull request Feb 7, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
castastrophe pushed a commit that referenced this pull request Feb 7, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
castastrophe pushed a commit that referenced this pull request Feb 7, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
castastrophe pushed a commit that referenced this pull request Feb 11, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
castastrophe pushed a commit that referenced this pull request Feb 24, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
castastrophe pushed a commit that referenced this pull request Feb 24, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
castastrophe pushed a commit that referenced this pull request Feb 25, 2025
* docs(tooltip): add missing args to template

- Tooltip was missing the `variant = "neutral"` arg, so adding that back
in renders the component

* chore(picker): add/correct arg naming

- adds missing placeholder arg to template
- corrects content arg to popoverContent

* chore(picker): remove window.isChromatic calls and click event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Results from a bug in the CSS implementation ready-for-review S2 Spectrum 2 size-1 XS ~1-6hrs; nearly trivial, a few hours, could do more than one in a single day.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants