Skip to content
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

Target xf css issue #418

Merged
merged 1 commit into from
Oct 6, 2023
Merged

Conversation

knennigtri
Copy link
Contributor

When using the WKND XFs in Target on a WKND page, the HTML imported into Target contains:

<body class="xf-web-container">
 <div class="container">
    <div class="root container responsivegrid">
      <div id="container-d5e81cbcff" class="cmp-container">
         ...

WKND's css library uses body .root { to set spacing at the top of the WKND site with elements.scss:

body {
 ...
  .root {
     max-width: $max-body-width;
     margin: 0 auto;
     padding-top:$header-height;
     ...

When a WKND XF is added to a WKND page using the VEC with an imported XF from AEM, the css above is applied to the XF and therefore the component padding-top is set to $header-height.

image

This can be fixed by fixing the template-type and template for the WKND experience fragment template.

Description

Under ui.content.sample and ui.content the root nodes are updated to xf-root:

  • conf/wknd/settings/wcm/template-types/empty-experience-fragment
  • conf/wknd/settings/wcm/templates/experience-fragment-web-variation-template
  • content/experience-fragments/wknd (all fragments)

This allows the WKND XFs to be imported into Target without the root class and therefor, the padding is not applied:

<body class="xf-web-container">
 <div class="container">
    <div class="xf-root container responsivegrid">
      <div id="container-d5e81cbcff" class="cmp-container">
         ...

image

Motivation and Context

This allows anyone to use WKND as a reference website for the AEM XF and Adobe Target integration flawlessly.

Someone can now use the pre-created XF content in WKND and apply it successfully and beautifully to the WKND site using Adobe Target without the components 'jumping around' on the page.

How Has This Been Tested?

All tested locally on 2023.06 SDK

  • Extra padding disappears when adding an imported WKND experience fragment to the WKND website
  • successfully create a new XF template from the XF template type
  • successfully use a new XF template
  • successfully use the current XF template
  • All experience fragments visually look correct in the experience fragment editor
  • All pages with XFs visually look correct

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@davidjgonzalez
Copy link
Contributor

davidjgonzalez commented Aug 10, 2023

@knennigtri Couldnt we just add CSS?:

body.xf-web-container .root { 
    all: unset;
}

(...or whatever needs to be unset/zero'd out)

my concern is that AEM OOTB the node name is called root, so i think you'd have to go in there and change the node names everything manually (in template and any existing nodes).

@davidjgonzalez davidjgonzalez self-requested a review August 10, 2023 17:21
@knennigtri
Copy link
Contributor Author

This is probably a simpler/more elegant solution. Let me investigate.

changed root node to xf-root

XFs updated to use xf-root

root node updated to xf-root.

ui.content module updated with xf-root

experience fragments root node updated to xf-root

Revert "ui.content module updated with xf-root"

This reverts commit 189c96e.

Revert "XFs updated to use xf-root"

This reverts commit f4d6132.

Revert "xf template and template-type updated"

This reverts commit 30044a2.

Update elements.scss

Adds use case to remove the top padding for experience fragments imported/used in Adobe Target.
@knennigtri
Copy link
Contributor Author

It looks like when an XF is imported into Target the HTML is different:

<div class="teaser cmp-teaser--featured aem-GridColumn aem-GridColumn--default--12">
  <div id="featured-article-magazine" class="cmp-teaser at-element-marker">
    <div>
      js/css for XF loaded
      <div class="container">
         <div class="root container responsivegrid">
            .....

Based on this snippet and @davidjgonzalez suggestion, I've updated this PR to update only elements.scss

Copy link
Contributor

@davidjgonzalez davidjgonzalez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice and simple! I love it. Nice callout of the at-element-marker too!

@SachinMali SachinMali merged commit 516c271 into adobe:main Oct 6, 2023
5 checks passed
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.

3 participants