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

fix: wrap texts in paragraphs in blocks #2

Merged
merged 6 commits into from
Feb 22, 2024
Merged

Conversation

buuhuu
Copy link
Collaborator

@buuhuu buuhuu commented Feb 12, 2024

Currently the <p> of text paragraphs in block cells are removed, which is semantically incorrect. This is a known issue in the helix-html-pipeline which has yet to be addressed. In the meantime, wrap any inline element (<a>, <strong>, <em>, <picture>, #text) in a <p> as part of the decoration phase. Skip h1-6 as those are already semantically correct.

Texts that are a single paragraph are not wrapped in  in block cells. This is a known issue and has yet to be fixed in the pipeline. It is semantically correct to wrap text in a .
Copy link

aem-code-sync bot commented Feb 12, 2024

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 PSI checks
  • Re-sync branch
Commits

Copy link

aem-code-sync bot commented Feb 12, 2024

Page Scores Audits Google
/drafts/drudolph/cards-block PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

scripts/aem.js Outdated
block.querySelectorAll(':scope > div > div').forEach((cell) => {
if (cell.textContent.trim()) {
const firstChild = cell.firstElementChild;
if (!firstChild || ['STRONG', 'EM', 'A'].includes(firstChild.tagName)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this include ol and ul tags as well?

Copy link
Collaborator Author

@buuhuu buuhuu Feb 13, 2024

Choose a reason for hiding this comment

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

<ul> and <ol> are already block-level elements. I only included inline elements that do not have a block-level parent atm (and texts).

This is also the case for default content, e.g. https://main--hlx-1--buuhuu.hlx.page/

...
<h1 id="congrats-you-are-ready-to-go">Congrats,<br>you are ready to go!</h1>
<p><span class="icon icon-search"></span></p>
<p>Your forked repo is setup as a helix project and you are ready to start developing.<br>The content you are looking at
  is served from this <a
    href="https://drive.google.com/drive/folders/1MGzOt7ubUh3gu7zhZIPb7R7dyRzG371j?usp=sharing">gdrive</a><br><br>Adjust
  the <code>fstab.yaml</code> to point to a folder either in your sharepoint or your gdrive that you shared with helix.
  See the full tutorial here:<br><br><a href="https://bit.ly/3aImqUL">https://www.hlx.live/tutorial</a></p>
<ul>
  <li>
    <ul>
      <li>
        <ul>
          <li>Sub list 2</li>
        </ul>
      </li>
    </ul>
  </li>
</ul>
<div class="columns">
...

The only exception I would make are <picture> elements which are inline as well, but have sufficient semantics already.

Strike that, we should also wrap <picture> to cover cases like text or links immediately following a picture.

@buuhuu buuhuu merged commit 49ca6bc into main Feb 22, 2024
3 checks passed
omprakashgupta1995 referenced this pull request in WWWPiramalFinanceCOM/piramalfinance Jul 2, 2024
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