Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Alt value: ActivityPub representation only picks value from attachment data #1121

Open
jeherve opened this issue Jan 2, 2025 · 2 comments
Labels

Comments

@jeherve
Copy link
Member

jeherve commented Jan 2, 2025

Quick summary

WordPress currently offers 2 ways to set an image's alt value: you can set that value in the attachment details, or you can set it within the image block settings.

When using the image block settings, the alt value is not visible in the ActivityPub representation.

Steps to reproduce

  1. Go to Posts > Add New
  2. Insert an image block
  3. Upload an image.
  4. in the block settings sidebar, define an alt text.
  5. Publish.

What you expected to happen

I expected the alt text to appear in the post's representation on the Fediverse.

What actually happened

Instead, I only see the alt text on the Fediverse if the image has an alt text set in Media > Library > Attachment details.

Impact

All

Available workarounds?

Yes, easy to implement

Logs or notes

No response

@jeherve jeherve added [Type] Bug Something isn't working Needs triage labels Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

This issue could use some more labels, to help prioritize and categorize our work. Could you please add at least a [Type], a [Feature], and a [Pri] label?

@pfefferle
Copy link
Member

pfefferle commented Jan 2, 2025

This is implemented and should work:

$check = preg_match( '/<img.*?alt\s*=\s*([\"\'])(.*?)\1.*>/i', $block['innerHTML'], $match );

Can you try to find out why this does not work for you? Do you use plugins that extend the image code so that the regex does not work properly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants