Skip to content

Social: Individual scrolling and update social media preview mockups to match current platform#47985

Draft
ederrengifo wants to merge 16 commits intotrunkfrom
experiment/social-ui-fixes
Draft

Social: Individual scrolling and update social media preview mockups to match current platform#47985
ederrengifo wants to merge 16 commits intotrunkfrom
experiment/social-ui-fixes

Conversation

@ederrengifo
Copy link
Copy Markdown

Fixes SOCIAL-432 SOCIAL-433

Proposed changes

Scrolling adjusment

  • Make scrolling working independently per each area (editor and preview content)
  • Change only work for desktop. For mobile, the content scrolling still work as before.

social-pr-scroll

Adjustments in preview mockups

Adjusted Facebook mockup
  • Minor UI adjustments
  • Adjust logic to switch format for when image is too small, based on facebook guidelines
  • Adjusted max-width for card
facebook
Adjusted Twitter/X mockup
  • Minor UI adjustments
  • Adjusted preview image with title as overlay
  • Applied max-height to attachment
twitter
Adjusted LinkedIn
  • Minor UI adjustments
  • Adjusted preview card which now shows the image in a smaller size
linkedin
Adjusted Instagram
  • Minor UI adjustments
  • Adjusted format for attachment based on platform limitations
instagram
Adjusted Tumblr
  • Minor UI adjustments
  • Updated link preview card with current format including title overlapping the image
  • Removed post content for when customize text exists (that's how it's displayed in Tumblr)
  • Adjusted format for attachment based on platform limitations
  • Adjusted max-width for card
tumblr
Adjusted Mastodon
  • Minor UI adjustments
  • Updated link preview card
  • Try to recreate the inclusion of author as part of the preview card
  • Added max-height to attachment
  • Adjusted max-width for card
mastodon
Adjusted Bluesky
  • Minor UI adjustments
  • Adjusted preview card UI
  • Added max-height to attachment
  • Adjusted max-width for card
bluesky
Adjusted Threads
  • Minor UI adjustments
  • Adjusted preview card UI and width
  • Added max-height to attachment
  • Adjusted max-width for card
threads

Other information

None

Related product discussion/links

p1HpG7-xW0

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

No

Testing instructions

Use the docs for useful testing snippets.

For the scrolling:

  • Upgrade account to see more elements in the modal
  • Make your screen smaller
  • See scroll working in the editor and the preview content

For the mockups:

  • Connected with each one of the listed platforms above
  • Compare the mockups with the platforms implementation (try to test link preview and attachment)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

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!


Super Cache plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@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 Apr 8, 2026
@ederrengifo ederrengifo force-pushed the experiment/social-ui-fixes branch from a1435b6 to ff17582 Compare April 8, 2026 20:06
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the experiment/social-ui-fixes branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack experiment/social-ui-fixes
bin/jetpack-downloader test jetpack-mu-wpcom-plugin experiment/social-ui-fixes

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control bot commented Apr 8, 2026

Code Coverage Summary

Coverage changed in 15 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/js-packages/social-previews/src/instagram-preview/post-preview.tsx 12/17 (70.59%) 70.59% 2 ❤️‍🩹
projects/js-packages/social-previews/src/facebook-preview/link-preview.tsx 3/3 (100.00%) 0.00% 0 💚
projects/js-packages/social-previews/src/twitter-preview/card.tsx 2/2 (100.00%) 0.00% 0 💚
projects/js-packages/social-previews/src/instagram-preview/icons/bookmark.tsx 2/2 (100.00%) 50.00% -1 💚
projects/js-packages/social-previews/src/instagram-preview/icons/comment.tsx 2/2 (100.00%) 50.00% -1 💚

2 files are newly checked for coverage.

File Coverage
projects/js-packages/social-previews/src/instagram-preview/icons/repost.tsx 2/2 (100.00%) 💚
projects/js-packages/social-previews/src/linkedin-preview/post/actions/index.tsx 3/3 (100.00%) 💚

Full summary · PHP report · JS report

@ederrengifo ederrengifo force-pushed the experiment/social-ui-fixes branch from 689c41d to ad0ae4e Compare April 8, 2026 21:00
Copy link
Copy Markdown
Contributor

@gmjuhasz gmjuhasz left a comment

Choose a reason for hiding this comment

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

Hi! Thanks for the braveness and jumping into this, I went through the code, this needs some refining on the code organization level. On a general note there are some things to be fixed, otherwise I also left specific things below as comments.

  • This PR got too big and should be separated into smaller PRs that are more focused on a specific fix/change.
  • There are some anti-patterns in the code like !important in scss files, which can cause races, we should use stricter selectors or modify those props in the parent if needed.
  • Every preview component had max-width: clamp(200px, 100%, Xpx) replaced with width: 100%; max-width: Xpx. The clamp() provided a minimum width of 200px, preventing the previews from collapsing too small. The new approach has no minimum width constraint. This could cause layout issues in narrow containers.
  • There are dead CSS selectors like
    • .facebook-preview__description styles remain in style.scss but the element was removed from the component
    • .facebook-preview__info remain but the element was removed
    • Portrait/landscape mode classes removed from components but some related CSS may still exist
  • There are some hardcoded values without explanation more max-heights and other CSS props, probably we should generalize them as much as possible
  • projects/plugins/jetpack/_inc/client/traffic/seo.jsx still passes description and imageMode to FacebookLinkPreview, but the component no longer uses either prop. The description was displayed to users in the SEO preview — this is a silent feature regression.

return (
<Fragment key={ entry.id }>
<Stack direction="column" gap={ labelSpacing }>
<Stack direction="column" gap={ labelSpacing as number }>
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.

This seems like a bandaid that hides a type issue that probably came up? It's in leaderboard-chart package which should be unrelated to the changes

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yeah, this was causing a failure in the checks and Claude suggested to fix it quickly here. Is there any other way to just ignore it?

__( '1h', 'social-previews' )
}
</span>
<span>1h</span>
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.

This change removes the translation and replaces it with a generic string

<div className="linkedin-preview__header--profile">
<div className="linkedin-preview__header--profile-info">
<div className="linkedin-preview__header--profile-name">
{ name || __( 'Account Name', 'social-previews' ) }
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.

The name prop fallback __( 'Account Name', 'social-previews' ) was removed. Now if name is undefined/empty, nothing renders. The separator and 1st indicator were also removed — are these intentional design changes?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Restoring both changes, the first one shouldn't have happened, and the second one initially thought as a way to simplify the mockup but in a second thought, would be better if matches better the output.

Comment on lines -58 to -71
<div
className={ `facebook-preview__description ${
compactDescription ? 'is-compact' : ''
}` }
>
{ description && facebookDescription( description ) }
{ isArticle &&
! description &&
// translators: Default description for a Facebook post
__( 'Visit the post for more.', 'social-previews' ) }
</div>
<div className="facebook-preview__info">
<FacebookPostIcon name="info" />
</div>
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.

This removes the full Facebook description block, is that intentional?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, facebook doesn't seem to show the description anymore as part of the link preview

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.

This file got messed up quite a bit, I see description was removed here as well, the helper and cardType props also got removed, probably by accident?

Copy link
Copy Markdown
Author

@ederrengifo ederrengifo Apr 9, 2026

Choose a reason for hiding this comment

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

Same as facebook, many link previews are not showing descriptions anymore. However, I understand the regression in terms of SEO so I'm fixing that aspect.

Comment on lines +39 to +44
const img = e.currentTarget;
const natural = img.naturalWidth / img.naturalHeight;
// Clamp between 4:5 (portrait) and 1.91:1 (landscape)
const clamped = Math.max( MIN_RATIO, Math.min( MAX_RATIO, natural ) );
setAspectRatio( clamped );
}, [] );
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.

The aspect ratio is derived from the image and won't change — this could cause a visual flash/reflow when the image loads and the container resizes from 1:1 to the clamped ratio. I think we should be using CSS aspect-ratio with object-fit instead

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

As far as I understand, Instagram doesn't allow that flexibility to accomodate to the image's aspect ratio and forces the images to be shown within a specific one Source. I'm addressing this as a something to avoid the visual flash but still comply with the way the image will be shown based on Instagram rules. Does that make sense? Because the same happen also in other cases where the image has to be shown in specific ratios.

@ederrengifo
Copy link
Copy Markdown
Author

Thank you for the review @gmjuhasz ! I will try to fix the issues first and then split it into smaller PRs. Do you suggest a PR for each mockup case? My first thinking was two PRs for the scrolling and the mockups but I also notice the changes in the mockups are not small.

@github-actions github-actions bot added [Plugin] Super Cache A fast caching plugin for WordPress. Docker E2E Tests labels Apr 9, 2026
@ederrengifo
Copy link
Copy Markdown
Author

I addressed the feedback and here is a quick summary of the latest updates:

Bug fixes:

  • Restored translated __( '1h' ) time string in LinkedIn header
  • Restored Account Name fallback for empty LinkedIn name prop
  • Restored • 1st connection degree indicator in LinkedIn header
  • Fixed SEO regression: FacebookLinkPreview accepts description prop again (for seo.jsx consumer) but does not render it in the mockup, matching current Facebook UI

Code quality:

  • Removed all !important declarations — replaced with more specific selectors (e.g. .facebook-preview__post
    .facebook-preview__url, .twitter-preview__card.twitter-preview__card)
  • Removed dead CSS: facebook-preview__info, facebook-preview__description.is-compact, is-portrait on body/image, is-empty image styles
  • Added min-width: 200px to all preview wrappers/sections to prevent collapse in narrow containers (restoring the clamp() minimum)
  • Added comments documenting platform-specific max-height values (510px Twitter, 430px Threads, 566px Mastodon, 516px Bluesky, 850px Facebook)
  • Removed build cache files from number-formatters

Instagram aspect ratio:

  • Replaced JS-only approach with hidden-until-loaded pattern (uses visibility: hidden during detection to prevent reflow flash, same pattern as Facebook's useImage hook)

Tumblr attachment: (Not part of the feedback but found the issue as I was testing)

  • Removed forced 4:3 aspect ratio — images now display at natural ratio, matching Tumblr's platform behavior

Twitter card border:

  • Replaced border: none !important with doubled class selector for higher specificity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants