Skip to content

feat(picture): fall back to image default caption - #1182

Merged
wesleyboar merged 2 commits into
mainfrom
feat/picture-default-caption
Jun 12, 2026
Merged

feat(picture): fall back to image default caption#1182
wesleyboar merged 2 commits into
mainfrom
feat/picture-default-caption

Conversation

@wesleyboar

@wesleyboar wesleyboar commented Jun 12, 2026

Copy link
Copy Markdown
Member

Overview

A Picture plugin only showed a caption when the editor typed one into the plugin. This falls back to the filer Image's own default caption when no instance-specific caption is set, so a shared image carries its caption everywhere without re-entering it — matching how alt already falls back to the image's default alt text.

Changes

  • added a default_caption fallback in picture.html: the <figure>/<figcaption> now render the image's default caption when there is no caption_text and no child plugins
  • added tests for the caption fallback (taccsite_cms/tests/djangocms_picture_default_caption.py)

Testing

  1. make start
  2. In a filer Image, set a Default caption.
  3. Add a Picture plugin using that image, leave its caption empty, and publish.
  4. Verify the rendered <figcaption> shows the default caption.
  5. Set the plugin's own caption text and verify it overrides the default.
  6. Add a child plugin (no caption text) and verify the default caption is not shown.
  7. docker exec core_cms python manage.py test taccsite_cms.tests.djangocms_picture_default_caption --no-input

UI

default.caption.works.mov

Notes

Tip

I also tested instance caption (with a default) and instance caption (with no default); both resulted in the instance caption being added under image.

When a Picture plugin has no instance-specific caption content (neither
caption_text nor child plugins), render the filer Image's default_caption
in the <figcaption>, mirroring the existing default_alt_text fallback for
the alt attribute and the blog template's use of default_caption.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@wesleyboar
wesleyboar merged commit 9686d50 into main Jun 12, 2026
@wesleyboar
wesleyboar deleted the feat/picture-default-caption branch June 12, 2026 23:19
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.

1 participant