Skip to content

fix: GH-1126 alt on parent elements of image#7

Closed
wesleyboar wants to merge 6 commits intomainfrom
cursor/pr-1127-warning-evaluation-d764
Closed

fix: GH-1126 alt on parent elements of image#7
wesleyboar wants to merge 6 commits intomainfrom
cursor/pr-1127-warning-evaluation-d764

Conversation

@wesleyboar
Copy link
Copy Markdown
Owner

@wesleyboar wesleyboar commented Mar 19, 2026

Important

Replaced by TACC#1127 (same content as of 96c849b.

This branch and PR was just for Cursor agent to have context and propose changes and test for me.

cursoragent and others added 2 commits March 19, 2026 19:02
Do not copy Picture `alt` attribute to parent `<figure>` nor `<a>`.

The '(assign attributes to parent)' workaround was originally introduced
because CSS :has() lacked wide browser support. Now that :has() is
universally supported, the workaround can be removed cleanly -- but
evaluation shows no :has() CSS is needed either:

- Bootstrap classes (img-fluid, img-thumbnail, rounded) now stay on
  <img> where they belong, so Bootstrap's own styles apply natively.
- The compensating CSS (:is(figure,a).img-fluid img etc.) was only
  required because those classes were moved to parent elements; with
  the move gone, the compensation is gone too.
- No :has() rules are needed to replicate parent behavior because
  there is no inherent requirement for parents to behave differently
  based on their children's Bootstrap classes.

Resolves WARNING to-do in PR TACC#1127.

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
Adds `create_picture_test_page` management command that builds a
published CMS page at /picture-test/ covering all combinations of:
- Bootstrap class (none, img-fluid, img-thumbnail, rounded, align-center)
- alt attribute (present / absent)
- wrapper context (no wrapper, link only, figure only, link + figure)

Uses external_picture with placehold.co so no file upload is needed.
Supports --delete flag to remove the page.

Run with:
  docker exec core_cms python manage.py create_picture_test_page

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
cursoragent and others added 4 commits March 25, 2026 18:46
Test CSS ships with v4.36 (PR TACC#968) and is not in the current main.
Reference the CDN copy from that PR's commit instead of a local path
that does not yet exist.

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
Two bugs found during visual testing:

1. Empty string '' passed as template caused path
   'djangocms_picture//picture.html' (TemplateDoesNotExist).
   Use 'default' explicitly for linked cases.

2. Combining link_url + no_link_to_ext_image template left <a>
   unclosed: that template's picture_link_end block is unconditionally
   empty (suppressing the external-picture auto-link), so it also
   swallows the </a> for explicit link_url links.
   Fix: use 'default' template for any case with has_link=True so the
   link open/close blocks are both in play.

3. 'INHERIT' page template caused TemplateDoesNotExist.
   Use 'standard.html' explicitly.

Co-authored-by: Wesley B <wesleyboar@users.noreply.github.com>
@wesleyboar
Copy link
Copy Markdown
Owner Author

Important

Replaced by TACC#1127 (same content as of 96c849b.

@wesleyboar wesleyboar closed this Mar 26, 2026
@wesleyboar wesleyboar deleted the cursor/pr-1127-warning-evaluation-d764 branch March 26, 2026 18:59
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