adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
723 stars 737 forks source link

Featured Image on Page dialog does not show alt value from DAM #2770

Open HitmanInWis opened 4 weeks ago

HitmanInWis commented 4 weeks ago

Bug present as of version: 2.24.7-SNAPSHOT

When loading a Page Properties dialog where the featured image is set, the Alt text from the DAM does not show in the "Alternative Text" box. NOTE: This bug does not happen on first set of the image (alt value is displayed correctly) - only upon opening the page properties dialog again after setting the image and saving.

HitmanInWis commented 4 weeks ago

This can be resolved by setting the altTextFromDAM property on initialization of JS code in image.js

Update the following code:

            altTextFromPage = $dialogContent.find(pageImageThumbnailImageSelector).attr("alt");

to:

            if (isPageDialog) {
                altTextFromDAM = $dialogContent.find('coral-fileupload[name="./cq:featuredimage/file"] img').attr("alt");
            } else {
                altTextFromPage = $dialogContent.find(pageImageThumbnailImageSelector).attr("alt");
            }

The isPageDialog var is effectively $(pageAltCheckboxSelector).length === 1 which is higher up in the initialization code.