Skip to content

WOOA7S-1695: Premium Analytics: centralize the widget-picker preview image-size fix in shared label components#50414

Open
Nikschavan wants to merge 3 commits into
trunkfrom
wooa7s-1695-clicks-widget-preview-icon-renders-very-large
Open

WOOA7S-1695: Premium Analytics: centralize the widget-picker preview image-size fix in shared label components#50414
Nikschavan wants to merge 3 commits into
trunkfrom
wooa7s-1695-clicks-widget-preview-icon-renders-very-large

Conversation

@Nikschavan

@Nikschavan Nikschavan commented Jul 10, 2026

Copy link
Copy Markdown
Member

Proposed changes

The widget picker renders live widget previews in an inert context where the preview grid stretches raw img elements to fill their container (.dataviews-view-picker-grid__media img { width: 100%; height: 100% }). Every widget that shows images was affected: Clicks favicons rendered enormous (WOOA7S-1695), and Authors, Locations, Visitors by location, and Subscribers list each carried their own near-identical per-widget workaround (e.g. #50393). Instead of patching each widget's stylesheet individually, this centralizes the picker-preview image-size fix in the shared components:

  • LeaderboardLabel now owns the inert-context image sizing via --jpa-leaderboard-image-* custom properties, and gains an imageFallback="hidden" prop for rows without an icon.
  • The Clicks and Referrers widgets render their row labels through the shared component, dropping their local label markup and per-widget fixes.
  • Authors, Locations, and Visitors-by-location migrate their existing overrides to the new custom properties, and their duplicated [inert] rules are removed.
  • The Subscribers-list avatar-size fix moves into the shared SubscriberList styles.

Net result: no per-widget picker fixes remain — the two shared components (LeaderboardLabel, SubscriberList) own the counter-rule, and any future widget using them is covered automatically. The durable upstream fix is still for @wordpress/widget-dashboard/@wordpress/dataviews to not apply media-thumbnail styling to widget previews; until then this keeps the workaround in one place per component instead of one per widget.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • On a site with Premium Analytics, open the dashboard widget picker (customize / add widget).
  • Check the Clicks widget preview card: favicons should render small (16px) next to labels, not stretched to fill the row.
  • Check the Referrers, Authors, Locations, Visitors by location, and Subscribers list previews still render their images/avatars at the correct size (16px favicons, 20px avatars, 28px-wide flags, 32px subscriber avatars).
  • Add the Clicks and Referrers widgets to the dashboard and confirm rows render as before: favicon + label on one line with the external-link arrow, 36px rows, rows without a favicon show no placeholder.
  • Check Locations/Visitors by location flags and Authors avatars render unchanged on the dashboard.

Before/after screenshots of the Clicks widget preview: to be added.

…erboardLabel

Move the inert-context (widget picker) image sizing into the shared LeaderboardLabel via --jpa-leaderboard-image-* custom properties, add an imageFallback prop to hide missing images, render Referrers row labels through the shared component, and migrate the Authors, Locations, and Visitors-by-location overrides to the new properties.
Render click row labels through the shared LeaderboardLabel component so the picker-grid image-size fix applies, replacing the local ClickLabel markup and styles.
…ponent

Relocate the inert-context avatar sizing from the widget's stylesheet into the shared SubscriberList styles and drop the now-empty widget CSS module.
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jul 10, 2026
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report

@Nikschavan Nikschavan changed the title WOOA7S-1695: Clicks widget: fix oversized favicons in the widget picker preview WOOA7S-1695: Premium Analytics: centralize the widget-picker preview image-size fix in shared label components Jul 11, 2026
@Nikschavan Nikschavan marked this pull request as ready for review July 11, 2026 04:12
@Nikschavan Nikschavan requested a review from a team as a code owner July 11, 2026 04:12
Copilot AI review requested due to automatic review settings July 11, 2026 04:12
@Nikschavan Nikschavan requested a review from a team as a code owner July 11, 2026 04:12
@Nikschavan Nikschavan removed request for a team July 11, 2026 04:12

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.

Pull request overview

Centralizes the widget-picker (DataViews) inert-preview image sizing workaround into shared Premium Analytics components so individual widgets no longer need their own [inert] img { … } overrides.

Changes:

  • Extend LeaderboardLabel to handle inert-preview image sizing via CSS custom properties and add imageFallback="hidden" for iconless rows.
  • Migrate Clicks + Referrers row labels to LeaderboardLabel and remove duplicated per-widget picker-preview CSS.
  • Move Subscribers list avatar sizing override into the shared SubscriberList component styles.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/packages/premium-analytics/widgets/subscribers-list/style.module.css Removes widget-local inert picker avatar override (now handled by shared component).
projects/packages/premium-analytics/widgets/subscribers-list/render.tsx Drops now-unneeded widget-local style wrapper.
projects/packages/premium-analytics/widgets/referrers/style.module.css Switches favicon sizing to LeaderboardLabel CSS vars + updates link/label layout for shared label markup.
projects/packages/premium-analytics/widgets/referrers/render.tsx Uses shared LeaderboardLabel for row labels (and hides missing icons).
projects/packages/premium-analytics/widgets/locations/style.module.css Migrates flag sizing override to LeaderboardLabel CSS vars (removes inert rule).
projects/packages/premium-analytics/widgets/clicks/style.module.css Switches favicon sizing to LeaderboardLabel CSS vars + updates link/label layout for shared label markup.
projects/packages/premium-analytics/widgets/clicks/render.tsx Uses shared LeaderboardLabel for row labels (and hides missing icons).
projects/packages/premium-analytics/widgets/authors/style.module.css Migrates avatar sizing override to LeaderboardLabel CSS vars (removes inert rule).
projects/packages/premium-analytics/packages/widgets-toolkit/src/widgets/visitors-by-location/visitors-by-location-widget.module.scss Migrates flag sizing override to LeaderboardLabel CSS vars (removes inert rule).
projects/packages/premium-analytics/packages/widgets-toolkit/src/components/subscriber-list/subscriber-list.module.scss Adds shared inert-preview override to keep avatars at 32px in picker previews.
projects/packages/premium-analytics/packages/widgets-toolkit/src/components/chart-leaderboard/leaderboard-label.tsx Adds imageFallback support and conditional rendering for missing images.
projects/packages/premium-analytics/packages/widgets-toolkit/src/components/chart-leaderboard/leaderboard-label.module.scss Adds CSS-var driven sizing + inert-preview override to counter DataViews stretching.
projects/packages/premium-analytics/changelog/refactor-subscribers-list-picker-image-fix Changelog entry for moving Subscribers list preview fix into shared component.
projects/packages/premium-analytics/changelog/refactor-referrers-leaderboard-label Changelog entry for centralizing leaderboard preview fix via LeaderboardLabel.
projects/packages/premium-analytics/changelog/fix-clicks-widget-preview-icon-picker-grid-size Changelog entry for fixing Clicks preview favicons via shared label.

Comment on lines +121 to +128
/* Width is the constraint that sizes flags: the boot layout shell forces
img { height: auto } at higher specificity, so a height here never applies
in the dashboard. `fill` (not `initial`, a CSS-wide keyword that would
unset the custom property) keeps the flag's aspect ratio uncropped. */
.leaderboardImage {
height: 20px;
--jpa-leaderboard-image-width: 28px;
--jpa-leaderboard-image-height: auto;
--jpa-leaderboard-image-fit: fill;
Comment on lines +47 to 55
// Width is the constraint that sizes flags: the boot layout shell forces
// img { height: auto } at higher specificity, so a height here never
// applies in the dashboard. `fill` (not `initial`, a CSS-wide keyword
// that would unset the custom property) keeps the flag uncropped.
.leaderboardImage {
height: 20px;
--jpa-leaderboard-image-width: 28px;
--jpa-leaderboard-image-height: auto;
--jpa-leaderboard-image-fit: fill;
border-radius: var(--wpds-border-radius-sm, 2px);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Premium Analytics [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants