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
733 stars 741 forks source link

[Content Fragment] Single Text mode shows title and description #730

Open godanny86 opened 5 years ago

godanny86 commented 5 years ago

Bug Report

Current Behavior When using the Content Fragment component and the Single Text Element display mode the fragment's Title and Description are displayed. Is this intentional? If this was intentional* I would expect an H1 to be used for the title (not an H3).

Expected behavior/code I would consider this a breaking change and would have introduced a v2 version of the component. Prior versions of the component did not do this.

Environment

Possible Solution This looks to have been introduced/as a result with the content fragment list. https://github.com/adobe/aem-core-wcm-components/blob/master/content/src/content/jcr_root/apps/core/wcm/components/contentfragment/v1/contentfragment/templates.html#L22 should be re-worked so that the h3 title and description are not shown when using Single text /paragraph mode.

Additional context / Screenshots

image Content Fragment Title/Description in properties

image Content Fragment Component - Single Text Element mode

I would expect in the above screenshot that only the contents of the content fragment to be shown, i.e Lorem Ipsum...

godanny86 commented 5 years ago

compare it with the Content Fragment markup in 2.3.2: https://github.com/adobe/aem-core-wcm-components/blob/core.wcm.components.reactor-2.3.2/extension/contentfragment/content/src/content/jcr_root/apps/core/wcm/extension/components/contentfragment/v1/contentfragment/templates.html#L17

richardhand commented 4 years ago

Hi @godanny86,

Seems similar to, but not the same as: https://github.com/adobe/aem-core-wcm-components/issues/596

Is this intentional?

I would consider this a breaking change and would have introduced a v2 version of the component. Prior versions of the component did not do this.

I'm not personally aware of the reason for adding this when moving the content fragment out of the extension package, maybe someone else can chip in? As the content fragment has a new resource this isn't technically breaking - a migration is required from the old extension resource type. I agree that a greater consistency between the two would have been better in the first step and then for a v2 to have been introduced, but we are where we are.

When using the Content Fragment component and the Single Text Element display mode

Why in single text element display mode only? Control of the fragment title and description rendering to me are independent of the element display mode.

I would expect an H1 to be used for the title (not an H3).

Makes sense.

ky940819 commented 4 years ago

Is there any update on this?

Historically, i have used the OOTB content fragment component; which now appears to be marked as deprecated as of AEM 6.5. I have looked into using this component as an alternative but it doesn't fully match up.

Always including the title, description, as well as hard-coding the <article> HTML5 semantic element makes me feel like this component is really more of an "Article" component, that happens to use a content fragment as the copy source. Sometimes the content fragment is just a fragment and not an entire article.

What if the Content Fragment component behaved more like the image component? They both reference dam assets. The dialog could include a field for "Title" and "Description" with a checkbox to inherit it from the dam asset (just like images do). They could be omitted in content, disabled via policy, or disabled by a simple dialog overlay if it doesn't make sense to include them in the specific use case.

Also, i would consider removing the hard-coded <article> semantic element, and adding "[article,div]" to the allowed element types, thus a template designer could choose if the content fragment should actually be an article in the "Styles" tab of the design dialog.