Skip to content

Add custom alt text support for gallery items#272

Merged
nk-o merged 8 commits into
masterfrom
feature/custom-gallery-item-alt
Jun 8, 2026
Merged

Add custom alt text support for gallery items#272
nk-o merged 8 commits into
masterfrom
feature/custom-gallery-item-alt

Conversation

@Fellan-91

Copy link
Copy Markdown
Collaborator

Summary

This PR adds custom alt text support for gallery items in the image-based content source.

Users can now edit alt text directly in the gallery item settings without modifying the original attachment meta in the WordPress Media Library.

What changed

  • added a per-item Alt field to Media Settings
  • initialized item-level alt from attachment alt when no local alt exists yet
  • made item-level alt the primary source for Image Alt source resolution
  • applied item-level alt priority to frontend image rendering
  • applied item-level alt priority to popup image data
  • updated sitemap alt resolution to use:
    • item-level alt
    • description fallback for legacy behavior
    • attachment alt
  • regenerated committed Gutenberg build artifacts

Tests

E2E

  • added coverage for gallery item alt behavior in block flow
  • added coverage for gallery item alt behavior in saved layout flow

Unit

  • added coverage for:
    • gallery alt sanitization
    • image alt source resolution
    • popup alt priority
    • sitemap alt priority

Validation

  • npm run build
  • npm run test:unit:php -- --filter 'Test_Class_(Security_Gallery_Alt|Get_Portfolio_Image_Alt|Sitemap_Image_Alt)'
  • npm run test:e2e -- tests/e2e/specs/added-images-to-block.spec.js tests/e2e/specs/added-images-to-saved-layout.spec.js

@nk-o nk-o merged commit e52b2b5 into master Jun 8, 2026
9 checks passed
@nk-o nk-o deleted the feature/custom-gallery-item-alt branch June 8, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants