Skip to content

Social: drop attachment toggle in per-network mode, promote Default media option#48573

Merged
manzoorwanijk merged 4 commits intotrunkfrom
update/social/per-network-default-media-option
May 8, 2026
Merged

Social: drop attachment toggle in per-network mode, promote Default media option#48573
manzoorwanijk merged 4 commits intotrunkfrom
update/social/per-network-default-media-option

Conversation

@manzoorwanijk
Copy link
Copy Markdown
Member

@manzoorwanijk manzoorwanijk commented May 6, 2026

Fixes #

Completes SOCIAL-473.

Proposed changes

  • Drop the forced "Share as attachment" toggle in per-network customization. The toggle was non-interactable and had no functional effect — its state was always implicit.
  • Promote media_source: 'none' to a first-class Default option in the media dropdown, surfaced only when the toggle is hidden (per-network mode). Picking Default produces no per-connection attachment; the destination network falls back to the post-level OG image.
  • Replace the forceMediaAsAttachment: boolean prop on SharePostForm / MediaSectionV2 with attachmentToggleMode: 'visible' | 'hidden'. Per-network passes 'hidden'.
  • In per-network mode:
    • The form reads strictly from the connection (no global media fallback). Uncustomized connections leave media_source undefined.
    • MediaSectionV2 skips detectMediaSource when the toggle is hidden, so undefined / missing media maps to Default.
    • The preview thumbnail mirrors the OG resolver: SIG (if globally enabled) → featured image → nothing.
    • Picking Default unsets media_source and attached_media on the connection, clearing the per-connection override entirely (REST update() already drops fields whose value is undefined).
  • No backend changes. wpcom's Extractor::is_social_post() already returns false for media_source: 'none' or missing, and get_attached_media() returns empty.

Related product discussion/links

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

No.

Testing instructions

  1. On a site with the paid Social features (SOCIAL_ENHANCED_PUBLISHING), open a post in the editor.
  2. Add at least two social connections.
  3. Set a featured image on the post and confirm the global media defaults to "Featured image".
  4. Open the per-network customize modal for one connection.
  5. The connection should land on Default in the media dropdown — not "Featured image".
    • The preview thumbnail should still show whatever the post's OG would serve (SIG image if global SIG is enabled, otherwise the featured image).
    • The "Share as attachment" toggle should NOT be rendered.
  6. Pick Featured image in the dropdown — connection now stores media_source: 'featured-image' and the actual featured image is attached on publish.
  7. Pick Default again — connection's media_source and attached_media are unset; on publish the share goes through as a regular link with the post-level OG preview.
  8. Pick Social image template — connection stores media_source: 'sig' and the SIG image is attached on publish.
  9. Pick From Media Library — connection stores media_source: 'media-library' with the chosen image, attached on publish.
  10. With Instagram (a requiresMedia network) selected: pick Default and confirm a NO_MEDIA_ERROR validation surfaces (Instagram requires a real attachment).
  11. In global mode (per-network not enabled), confirm the dropdown does NOT include the Default option — the existing SIG / Featured / Media Library / AI Image options behave exactly as before.
  12. Confirm the post-level OG tag (og:image) is unchanged for any of these per-connection states.
Screen.Recording.2026-05-06.at.7.46.50.PM.mov

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 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), and enable the update/social/per-network-default-media-option branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/social/per-network-default-media-option

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 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!

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 6, 2026

Code Coverage Summary

Coverage changed in 5 files.

File Coverage Δ% Δ Uncovered
projects/packages/publicize/_inc/components/media-section-v2/index.tsx 79/102 (77.45%) -0.44% 2 ❤️‍🩹
projects/packages/publicize/_inc/components/media-section-v2/media-source-menu-item.tsx 9/9 (100.00%) 0.00% 0 💚
projects/packages/publicize/_inc/components/media-section-v2/media-source-menu.tsx 22/22 (100.00%) 0.00% 0 💚
projects/packages/publicize/_inc/components/media-section-v2/utils/media-source-options.ts 18/19 (94.74%) 8.07% -1 💚
projects/packages/publicize/_inc/components/customize-and-preview/customization-forms/per-network.tsx 24/26 (92.31%) 20.88% -10 💚

Full summary · PHP report · JS report

@gmjuhasz
Copy link
Copy Markdown
Contributor

gmjuhasz commented May 6, 2026

I haven't tested it yet just watched the video, since SIG and Featured image options from the dropdown will now behave as attachment, should they be categorized under the attachment tab in the dropdown?

@manzoorwanijk
Copy link
Copy Markdown
Member Author

since SIG and Featured image options from the dropdown will now behave as attachment, should they be categorized under the attachment tab in the dropdown?

Good point.

@manzoorwanijk manzoorwanijk force-pushed the update/social/per-network-default-media-option branch from e115938 to ca3ea5f Compare May 7, 2026 03:09
@manzoorwanijk
Copy link
Copy Markdown
Member Author

since SIG and Featured image options from the dropdown will now behave as attachment, should they be categorized under the attachment tab in the dropdown?

I have updated it and also added that checkmark to show which option is selected.

Screenshot 2026-05-07 at 8 51 59 AM

@manzoorwanijk manzoorwanijk marked this pull request as ready for review May 7, 2026 04:14
manzoorwanijk and others added 3 commits May 7, 2026 12:47
In per-network customization, the "Share as attachment" toggle is forced
ON and non-interactable, so it currently has no functional purpose.
Remove it and add a "Default" option to the media dropdown that maps to
the existing media_source: 'none' value. Picking Default leaves the
share without a per-connection attachment, so the destination network
falls back to the post-level OG image. Picking any other source attaches
that image as today.

The Default option is only surfaced when the attachment toggle is hidden
(per-network mode); global mode is unchanged.

No backend changes — Extractor::is_social_post() already returns false
for media_source: 'none' in the per-connection branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Default is now the rendered state for any per-network connection that
has no explicit override (Featured image was previously auto-selected via
detect-media-source even though attached_media was empty, which made
"Featured image" appear selected without actually being attached).

- Drop the globalMediaSource / synthesized attached_media fallback in
  PerNetworkCustomizationForm. Connections inherit nothing from global
  media; uncustomized connections leave media_source undefined.
- MediaSectionV2 skips detectMediaSource when the attachment toggle is
  hidden (per-network mode), so undefined media_source maps to Default.
- MediaSectionV2 preview mirrors the OG resolver in Default mode:
  SIG (if globally enabled) → featured image → nothing.
- handleSourceSelect unsets both media_source and attached_media when
  Default is picked, so the saved connection override is cleared
  (REST update() drops fields whose value is undefined).

No backend changes — Extractor::is_social_post() already returns false
when media_source is missing or 'none'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Render selected media-source items with role="menuitemradio" and a check
  icon suffix so the active option is visually identifiable. The previous
  approach (disabled + greyed out) read as "unclickable" rather than
  "selected".
- Switch the option icon to iconPosition="left" so the option icon and
  the selected check don't fight for the same slot.
- Re-clicking the active terminal source (Default / Featured image /
  SIG) is a no-op; re-clicking media-library / ai-image still re-opens
  their picker so users can swap to a different image.
- In per-network mode, surface SIG and Featured image under "Attachment"
  rather than "Link preview". With the toggle hidden, those sources
  always attach — the old grouping was misleading. Default is the only
  link-preview option in per-network.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@manzoorwanijk manzoorwanijk force-pushed the update/social/per-network-default-media-option branch from c76b6ac to 5969f15 Compare May 7, 2026 07:26
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.

I wonder if for default we should update the tooltip to be more specific. Maybe it could be more specific and state that it's the featured image/ social image template based on the set opengraph tags?

Image

@manzoorwanijk
Copy link
Copy Markdown
Member Author

Maybe it could be more specific and state that it's the featured image/ social image template based on the set opengraph tags?

I initially wanted to add that OG text, but I think it’s more technical for most of the users.

@gmjuhasz
Copy link
Copy Markdown
Contributor

gmjuhasz commented May 7, 2026

I initially wanted to add that OG text, but I think it’s more technical for most of the users.

That makes sense

gmjuhasz
gmjuhasz previously approved these changes May 7, 2026
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.

Okay this works as intended to me. The "default" wording is still something I like less because its not clear what that means, but it's also pretty hard to explain better, and the preview show it on the right. Let's show it to design and see what they think

@manzoorwanijk manzoorwanijk merged commit d64b80d into trunk May 8, 2026
75 checks passed
@manzoorwanijk manzoorwanijk deleted the update/social/per-network-default-media-option branch May 8, 2026 07:47
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] In Progress labels May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Publicize Now Jetpack Social, auto-sharing [Package] Publicize [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants