Skip to content

Remove global display block to img - #1427

Merged
rezrah merged 4 commits into
mainfrom
rezrah/remove-block-image-reset
Jul 28, 2026
Merged

Remove global display block to img#1427
rezrah merged 4 commits into
mainfrom
rezrah/remove-block-image-reset

Conversation

@rezrah

@rezrah rezrah commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Towards #1426

Our long-standing global reset for img and picture is now causing downstream issues in Dotcom. While this is a downstream issue, the reality is that style shouldn't be applied through a reset, but instead through each component.

This is likely to break things downstream of us, as users may be unknowingly relying on this rule. Marked this change as a minor (breaking change)

Also cleans up smooth scrolling rules, fixing a bug where auto wasn't applying correctly for users with smooth scroll.

List of notable changes:

  • removes the global display: block to img and picture elements.
  • adds display: block to component img and picture elements

What should reviewers focus on?

Steps to test:

  1. Check images in our stories still apply display block

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

N/A

@rezrah
rezrah requested a review from a team as a code owner July 28, 2026 10:25
Copilot AI review requested due to automatic review settings July 28, 2026 10:25
@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9ebd1ee

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

This PR includes changesets to release 9 packages
Name Type
@primer/react-brand Minor
@primer/brand-docs Minor
@primer/brand-css Minor
@primer/brand-primitives Minor
@primer/brand-e2e Minor
@primer/brand-fonts Minor
@primer/brand-mcp Minor
@primer/brand-config Minor
@primer/brand-storybook 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

@github-actions

Copy link
Copy Markdown
Contributor

🟢 No design token changes found

@rezrah
rezrah requested a review from danielguillan July 28, 2026 10:27
img,
picture {
max-width: 100%;
display: block;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The main change ☝️

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🟢 Unit test coverage changes found

Unit test coverage has been updated through this PR.

Changes: 0 new tests, 0 removed tests, 1 improved, 0 decreased

Component/Hook Statements Functions Branches Change
PricingOptions 99.2% 97.1% 93.7% 95.1% +1.4%

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🟢 Bundle size report

CheckMainBranchChange
UMD — full bundle (JS)101.73 kB101.76 kB⬆️ +25 B (+0.0%)
UMD — full bundle (CSS)67.49 kB67.55 kB⬆️ +57 B (+0.1%)
ESM — full bundle (JS + CSS)1.59 MB1.59 MB⬆️ +869 B (+0.1%)
ESM — tree-shaken simple (Button)70.71 kB70.78 kB⬆️ +74 B (+0.1%)
ESM — tree-shaken complex (ActionMenu)79.67 kB79.74 kB⬆️ +74 B (+0.1%)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Removes the global display: block reset on img/picture in @primer/react-brand to prevent unintended downstream overrides (notably in GitHub README rendering), and reintroduces display: block where needed within specific components.

Changes:

  • Removed display: block from the shared reset.css img, picture rule.
  • Added component-scoped display: block rules for images/pictures across several React Brand components.
  • Added a changeset documenting the breaking/minor release impact.
Show a summary per file
File Description
packages/react/src/css/reset.css Removes global display: block from img, picture while keeping max-width: 100%.
packages/react/src/Avatar/Avatar.module.css Ensures avatar <img> renders as display: block at the component level.
packages/react/src/EyebrowBanner/EyebrowBanner.module.css Sets display: block for leading visual img/picture to preserve layout.
packages/react/src/LogoSuite/LogoSuite.module.css Forces img inside the logobar to be block-level to avoid inline baseline gaps.
packages/react/src/MinimalFooter/MinimalFooter.module.css Makes social icon element block-level to preserve sizing/layout after reset change.
packages/react/src/river/river-shared.module.css Applies display: block to img/picture within .River__visual to keep media layout consistent.
packages/react/src/river/RiverStoryScroll/RiverStoryScroll.module.css Makes RiverStoryScroll media block-level for consistent centering/layout.
packages/react/src/Testimonial/Testimonial.module.css Adds a new .Testimonial-logo-image { display: block; } rule for testimonial logo images.
packages/react/src/Testimonial/Testimonial.module.css.d.ts Updates generated CSS module typings for the new testimonial logo image class.
.changeset/fresh-images-flow.md Documents the breaking/minor change and migration guidance for consumers.

Review details

  • Files reviewed: 10/11 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread packages/react/src/Testimonial/Testimonial.module.css
Comment thread .changeset/fresh-images-flow.md Outdated
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@danielguillan danielguillan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. I believe the main scenarios are covered.

We may still need to apply the rule to some component slots intended to support media, such as BreakoutBanner.leadingVisual or the leading and trailing escape hatches for Statistic.

@rezrah
rezrah merged commit d104c0d into main Jul 28, 2026
17 of 20 checks passed
@rezrah
rezrah deleted the rezrah/remove-block-image-reset branch July 28, 2026 13:27
@primer primer Bot mentioned this pull request Jul 28, 2026
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.

3 participants