-
Notifications
You must be signed in to change notification settings - Fork 754
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
SITES-28693 - Teaser Component Renders Broken HTML When Title is Empty #2921
base: main
Are you sure you want to change the base?
Conversation
* Updated teaser to only allow image to render links if all other elements are empty (pre-title, title, description, actions), in which case it will unwrap the general link on the teaser content. Fixes #2660
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2921 +/- ##
=========================================
Coverage 87.14% 87.14%
- Complexity 2697 2698 +1
=========================================
Files 235 235
Lines 7202 7202
Branches 1104 1104
=========================================
Hits 6276 6276
Misses 366 366
Partials 560 560 ☔ View full report in Codecov by Sentry. |
bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v2/TeaserImpl.java
Outdated
Show resolved
Hide resolved
* Incorporated PR feedback
|
@vladbailescu , it looks like, when image + valid link is set and pre-title, title, description, actions are blank then we still have nested anchors. |
@@ -81,7 +81,8 @@ protected void initImage() { | |||
overriddenImageResourceProperties.put(Teaser.PN_ACTIONS_ENABLED, Boolean.valueOf(actionsEnabled).toString()); | |||
overriddenImageResourceProperties.put(PN_ID, String.join(ID_SEPARATOR, this.getId(), IMAGE_ID_PREFIX)); | |||
|
|||
if (StringUtils.isNotEmpty(getTitle()) || getTeaserActions().size() > 0) { | |||
// Only allow image to render links if all other elements are empty | |||
if (!(StringUtils.isAllBlank(getTitle(), getPretitle(), getDescription()) && getTeaserActions().isEmpty())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need '||' here instead of '&&" as before.
Fixes #2660