Remove global display block to img - #1427
Conversation
🦋 Changeset detectedLatest commit: 9ebd1ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
🟢 No design token changes found |
| img, | ||
| picture { | ||
| max-width: 100%; | ||
| display: block; |
🟢 Unit test coverage changes foundUnit test coverage has been updated through this PR. Changes: 0 new tests, 0 removed tests, 1 improved, 0 decreased
|
🟢 Bundle size report
|
There was a problem hiding this comment.
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: blockfrom the sharedreset.cssimg, picturerule. - Added component-scoped
display: blockrules 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
🟢 No visual differences foundOur visual comparison tests did not find any differences in the UI. |
danielguillan
left a comment
There was a problem hiding this comment.
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.
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
autowasn't applying correctly for users with smooth scroll.List of notable changes:
display: blockto img and picture elements.display: blockto component img and picture elementsWhat should reviewers focus on?
Steps to test:
Contributor checklist:
update snapshotslabel to the PR)Reviewer checklist:
Screenshots:
N/A