Skip to content

fix: nested .section fragment bug#16

Merged
fkakatie merged 2 commits into
mainfrom
fragment
Jun 27, 2026
Merged

fix: nested .section fragment bug#16
fkakatie merged 2 commits into
mainfrom
fragment

Conversation

@fkakatie

Copy link
Copy Markdown
Contributor

Problem: Fragment links on pages were getting wrapped in .default-content-wrapper.

Root cause: buildFragmentAutoBlocks was async. It hid the fragment <p> but didn't convert it to a block element before decorateSections ran, so the <p> got wrapped into .default-content-wrapper. By the time the async load resolved, the replacement landed inside that wrapper.

Proposed fix:

  • scripts/scripts.jsbuildFragmentAutoBlocks now synchronously converts the fragment link <p> into a real fragment block div (same pattern as widget/video auto-blocks) before decorateSections runs.
  • blocks/fragment/fragment.jsdecorate() now handles two cases:
    • fragment is the only thing in its section: replaces the whole section with the fragment's sections, making them proper siblings in <main>
    • fragment is mixed with other content: strips the fragment's inner section wrappers and flattens the block wrappers directly into the containing section, preserving document order

Headline: No nested .section divs in either case. 🎉

Test URLs:

@aem-code-sync

aem-code-sync Bot commented Jun 27, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@aem-code-sync

aem-code-sync Bot commented Jun 27, 2026

Copy link
Copy Markdown
Page Scores Audits Google
📱 /en/company/leadership PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /en/company/leadership PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@fkakatie fkakatie requested a review from davidnuescheler June 27, 2026 06:21
@fkakatie fkakatie merged commit c767979 into main Jun 27, 2026
2 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.

2 participants