Skip to content

fix(typography): unintended typography element margins #5576

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 3 commits into
base: main
Choose a base branch
from

Conversation

saashapina
Copy link
Collaborator

@saashapina saashapina commented Jun 26, 2025

Description

Removes --spectrum-detail-margin-start and --spectrum-detail-margin-end definitions from .spectrum-Detail and .spectrum-Heading ensuring margin custom properties are scoped only to .spectrum-Typography .spectrum-Heading and .spectrum-Typography .spectrum-Detail.

Motivation and context

We recently made a change in the Typography CSS that unintentionally scoped margin custom properties more broadly than intended. Typography margin custom properties should only be scoped to .spectrum-Typography

Related issue(s)

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Copy link

changeset-bot bot commented Jun 26, 2025

⚠️ No Changeset found

Latest commit: b1f0645

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

github-actions bot commented Jun 26, 2025

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5576

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

Copy link

Tachometer results

Currently, no packages are changed by this PR...

@saashapina saashapina marked this pull request as ready for review June 26, 2025 17:28
@saashapina saashapina requested a review from a team as a code owner June 26, 2025 17:28
@saashapina saashapina self-assigned this Jun 26, 2025
@rise-erpelding rise-erpelding self-requested a review June 27, 2025 17:41
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'm not really sure if there's a great way to test this, but here's what I did when I was initially investigating the bug:

  1. Go to one of the Divider component's stories within Storybook
  2. Inspect the heading component there, confirm that it does have top and bottom margins
  3. Remove the .spectrum-Typography class from the parent div, confirm that there are no margins

So far this works fine! But if I change the .spectrum-Heading class into .spectrum-Detail to test the same with the Detail component, it doesn't work. The detail has margins both with the parent .spectrum-Typography class and also without it, which isn't expected behavior, so I'm wondering if we missed something somewhere.

On the original PR that introduced the issue (#5295), I see that the same --spectrum-heading-margin-start/-end being added to .spectrum-Heading rather than only .spectrum-Typography .spectrum-Heading being introduced in tools/styles/fonts.css as well, so maybe we need to roll those changes back also? Although the margins work just fine for heading so I find that puzzling 🤔 See https://github.com/adobe/spectrum-web-components/blob/saasha/fix-typography-margin/tools/styles/fonts.css#L76-L77

Likewise, that same PR does the same thing for .spectrum-Detail margins in that fonts.css file, see https://github.com/adobe/spectrum-web-components/blob/saasha/fix-typography-margin/tools/styles/fonts.css#L505-L506, so maybe that can be reverted back to what it was before also?

I also see the same being introduced in that PR in tools/styles/typography.css, see https://github.com/adobe/spectrum-web-components/blob/saasha/fix-typography-margin/tools/styles/typography.css#L76-L77 and https://github.com/adobe/spectrum-web-components/blob/saasha/fix-typography-margin/tools/styles/typography.css#L505-L506

Not sure if that would create any effect that we'd notice locally or in the branch deploy urls, but it would at least fully roll back the change? 🤷‍♀️

@saashapina saashapina force-pushed the saasha/fix-typography-margin branch 2 times, most recently from e0bc47a to efc93ce Compare July 7, 2025 04:46
@saashapina
Copy link
Collaborator Author

Not sure if that would create any effect that we'd notice locally or in the branch deploy urls, but it would at least fully roll back the change? 🤷‍♀️

Good catches! I've rolled back these additional areas where the --spectrum-heading-margin-start/-end custom variables were being applied to the .spectrum-Heading/Details class and I ran an entire repo search to ensure they've all been removed from those classes but for some reason they're still showing up in the browser 🤔 Is this still happening on your end as well with the latest changes?

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.

Looks great!

@saashapina saashapina force-pushed the saasha/fix-typography-margin branch from efc93ce to ba8b779 Compare July 7, 2025 18:42
@castastrophe castastrophe force-pushed the saasha/fix-typography-margin branch from ba8b779 to 284e9b2 Compare July 8, 2025 19:46
@saashapina saashapina added ready-for-merge Will auto-update until merged and removed ready-for-review labels Jul 8, 2025
@castastrophe castastrophe force-pushed the saasha/fix-typography-margin branch from 284e9b2 to 3041443 Compare July 10, 2025 15:32
@castastrophe castastrophe force-pushed the saasha/fix-typography-margin branch from 3041443 to 42776a6 Compare July 11, 2025 13:45
@castastrophe castastrophe enabled auto-merge (squash) July 11, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Will auto-update until merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants