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

Bug fix: fragment block should include fragment classnames [HTML DOM change] #434

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ujjwal5
Copy link

@ujjwal5 ujjwal5 commented Nov 19, 2024

Please always provide the GitHub issue(s) your PR is for, as well as test URLs where your change can be observed (before and after):

Fix #409

Test URLs:

Before: https://fragment-block-fix--ancestry--aemsites.aem.live/drafts/ujjgupta/test-frgament
After: https://main--ancestry--aemsites.aem.live/drafts/ujjgupta/test-frgament

Copy link

aem-code-sync bot commented Nov 19, 2024

Page Scores Audits Google
📱 /drafts/ujjgupta/test-frgament PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /drafts/ujjgupta/test-frgament PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@ujjwal5
Copy link
Author

ujjwal5 commented Nov 19, 2024

Currently, the styles applied to a 'fragment' block are lost when the HTML is replaced. Ideally, any styles defined for the block should be retained. Additionally, the HTML structure of the fragment block is different from other blocks. Normally, the structure follows the pattern: container → wrapper → block. However, for the fragment block, it follows container → wrapper, omitting the block level.

HTML structure with existing code:

<div class="section fragment-container" data-section-status="loaded" style="">
   <div class="fragment-wrapper">
      <div class="section" data-section-status="loaded" data-key="value" style="">
         <div class="default-content-wrapper">
            <p>Would you like to see what you can discover about your family?</p>
            <ul>
               <li>Yes</li>
               <li>No</li>
               <li>I’m not sure</li>
            </ul>
            <p class="button-container"><a href="https://www.ancestry.com/onboarding/lop/questionnaire/intro" title="Continue" class="button">Continue</a></p>
            <p class="button-container"><a href="#" title="Dismiss" class="button">Dismiss</a></p>
         </div>
      </div>
   </div>
</div>

Proposed HTML structure with fixed issues:

<div class="section fragment-container" data-section-status="loaded" style="">
   <div class="fragment-wrapper">
      <div class="fragment animate block" data-block-name="fragment" data-block-status="loaded">
         <div class="section" data-section-status="loaded" data-key="value" style="">
            <div class="default-content-wrapper">
               <p>Would you like to see what you can discover about your family?</p>
               <ul>
                  <li>Yes</li>
                  <li>No</li>
                  <li>I’m not sure</li>
               </ul>
               <p class="button-container"><a href="https://www.ancestry.com/onboarding/lop/questionnaire/intro" title="Continue" class="button">Continue</a></p>
               <p class="button-container"><a href="#" title="Dismiss" class="button">Dismiss</a></p>
            </div>
         </div>
      </div>
   </div>
</div>

@ujjwal5
Copy link
Author

ujjwal5 commented Nov 19, 2024

@kptdobe FYI, please help in reviewing. Thanks!

@kptdobe
Copy link
Contributor

kptdobe commented Nov 19, 2024

I see the problem. And I also see more problems... The fragment block introduces sections in sections, but that's unrelated to your PR. Your PR is about respecting the block logic, i.e. the fragment block stays a block while current logic removes the block div.
I think your PR makes sense but we probably need the original developer (@davidnuescheler)'s input here.

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.

Fragment block should retain authored classes
2 participants