Skip to content

SkeletonAvatar: Fix stylesheet-order-dependent size and shape - #8628

Open
joshblack wants to merge 2 commits into
mainfrom
fix/skeleton-avatar-style-precedence
Open

joshblack wants to merge 2 commits into
mainfrom
fix/skeleton-avatar-style-precedence

Conversation

@joshblack

@joshblack joshblack commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Closes #8627

This PR fixes skeleton sizing and shape depending on stylesheet order by separating the shared loading appearance from component geometry.

SkeletonBox, SkeletonAvatar, and SkeletonText now use the same .skeleton utility from Skeleton/skeleton.module.css for background color, shimmer, reduced-motion handling, and forced-colors treatment. Each component owns its dimensions and shape.

Avatar and Text render their own elements instead of composing SkeletonBox. This removes the competing box geometry rather than increasing selector specificity. SkeletonBox keeps its existing delayed-rendering behavior.

Both screenshots render <SkeletonAvatar size={40} /> with the real SkeletonBox CSS appended last.

Before (40px by 16px) After (40px by 40px)
Before the fix, the avatar is a short rounded rectangle After the fix, the avatar remains a circle

Changelog

New

None.

Changed

  • Share the loading treatment across SkeletonBox, SkeletonAvatar, and SkeletonText without sharing geometry.
  • Preserve avatar and text sizing and shape independently of SkeletonBox stylesheet order.
  • Cover rendered geometry, responsive sizing, dimension overrides, and shared loading appearance without scanning or copying stylesheet rules.

Removed

None.

Rollout strategy

  • No changes needed in github/github-ui
  • Needs changes in github/github-ui
  • Ships with feature flag(s)
  • Not sure
  • None

Patch release. No public API changes or consumer migration are needed.

Testing & Reviewing

The component tests assert rendered size, shape, shared loading appearance, and existing dimension overrides. Responsive avatar coverage includes all three breakpoints, and text coverage includes single and multiple lines.

For manual review, follow the browser-console reproduction in #8627. A 40px avatar should remain a 40px circle after appending the box styles. Square avatars should retain their square shape, and responsive avatars should retain their configured height at each breakpoint. Also check text sizes and multiline rendering, along with reduced-motion and forced-colors behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a50bbce8-e484-4763-b28d-9ce7265a4b7c
Copilot AI balanced review requested due to automatic review settings October 27, 2026 20:40
@joshblack
joshblack requested a review from a team as a code owner October 27, 2026 20:40
@joshblack
joshblack requested a review from TylerJDev October 27, 2026 20:40
@changeset-bot

changeset-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b7bcb7a

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

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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 github-actions Bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The narrow specificity fix addresses the reported cascade conflict, includes targeted regression coverage, and has no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes #8627 by making SkeletonAvatar sizing and shape independent of whether shared SkeletonBox styles load last, without changing the public API.

Changes:

  • Increases avatar selector specificity using its existing component identifier.
  • Adds five regression cases covering circular and square avatars and three responsive breakpoints.
  • Includes a patch changeset for @primer/react.
File Description
packages/​react/​src/​SkeletonAvatar/​SkeletonAvatar.test.tsx Verifies dimensions and shape with box styles appended last.
packages/​react/​src/​SkeletonAvatar/​SkeletonAvatar.module.css Gives avatar styles precedence over shared box styles.
.changeset/​skeleton-avatar-style-precedence.md Records the fix for a patch release.

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a50bbce8-e484-4763-b28d-9ce7265a4b7c

This branch was successfully deployed

2 active deployments
storybook-preview-8628 — b7bcb7ad Deployed Oct 27, 2026 by github-actions[bot]
github-pages — b7bcb7ad Deployed Oct 27, 2026 by joshblack via deploy-preview #33910
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SkeletonAvatar size and shape depend on stylesheet load order

2 participants