fix: GH-1126 alt on parent elements of image#1127
Draft
wesleyboar wants to merge 9 commits intomainfrom
Draft
Conversation
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 #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>
Test CSS ships with v4.36 (PR #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>
…n-d764' into fix/gh-1126-alt-attr-on-picture-parent-elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Do not copy Picture
altattribute to parent<figure>nor<a>.Caution
Has not been tested under known contexts on any client website.
Important
Related
Changes
(assign attributes to parent)codewhich had lost classes that had been moved to parent elements/sup>
which had received alignment from classes that no longer get
which adds
align-mixinsTesting
See #1126.
UI
Warning
This only basic basic testing. It does not show testing on complex page created with script (but that is tested).
img.alt.and.class.NOT.added.to.link.mov
img.alt.and.class.NOT.added.to.link.and.figure.mov
img.alt.and.class.NOT.added.to.figure.mov