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

after body page navigation is wrong on some website #8555

Closed
cderv opened this issue Feb 2, 2024 · 0 comments · Fixed by #8561
Closed

after body page navigation is wrong on some website #8555

cderv opened this issue Feb 2, 2024 · 0 comments · Fixed by #8561
Assignees
Labels
backport bug Something isn't working websites Issues creating websites
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Feb 2, 2024

We can see this on several website :
image

I believe they are all deployed on Netlify (to be confirmed)

It is possible this issue comes from problem we have in our after body template.

First we are missing a quote here:

<a href="<%- nav.prevPage.href %>" class="pagination-link aria-label="<%- nav.prevPage.text %>">

Easy fix (dd89c2f - possibly this was the issue in #7319 initially)

other problem : both in line above and in this one

<a href="<%- nav.nextPage.href %>" class="pagination-link" aria-label="<%- nav.nextPage.text %>">

we are inserting in aria-label more than text.

Example from: https://feaz-book.com/introduction

This is the HTML source on github in the repo https://github.com/EmilHvitfeldt/feature-engineering-az/blob/5f5ef5b4c48f502b28e565773f6dcec0f0f39c5c/_book/introduction.html#L1740-L1744

  <div class="nav-page nav-page-next">
      <a href="./numeric.html" class="pagination-link" aria-label="<span class='chapter-number'>1</span>&nbsp; <span class='chapter-title'>Numeric Overview</span>">
        <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Numeric Overview</span></span> <i class="bi bi-arrow-right-short"></i>
      </a>
  </div>

Note that we have a rather complex aria-label we should not have IMO, which mix ' and ".

This is what we can see in the source page on the deployed website (https://feaz-book.com/introduction with view-source mode in chrome)

  <div class="nav-page nav-page-next">
      <a aria-label='<span class=\'chapter-number\'>1</span>&nbsp; <span class=\'chapter-title\'>Numeric Overview</span>' class='pagination-link' href='/numeric'>
        <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Numeric Overview</span></span> <i class="bi bi-arrow-right-short"></i>
      </a>
  </div>

So quotes are changed, and mess up a bit, which lead to a bad DOM and the problem of the screenshot.

So something to look into in the sidebar content that gets inner HTML representation with <span> and not just the text without HTML structure.

@cderv cderv added the websites Issues creating websites label Feb 2, 2024
@cderv cderv added the bug Something isn't working label Feb 2, 2024
cderv added a commit that referenced this issue Feb 2, 2024
dragonstyle added a commit that referenced this issue Feb 2, 2024
Books were injecting HTML tags into the nav item text, which would cause HTML tags to be embedded within the aria-label. Instead, use a plain text representation.

Fixes #8555
dragonstyle added a commit that referenced this issue Feb 2, 2024
Books were injecting HTML tags into the nav item text, which would cause HTML tags to be embedded within the aria-label. Instead, use a plain text representation.

Fixes #8555
dragonstyle pushed a commit that referenced this issue Feb 2, 2024
dragonstyle added a commit that referenced this issue Feb 2, 2024
Books were injecting HTML tags into the nav item text, which would cause HTML tags to be embedded within the aria-label. Instead, use a plain text representation.

Fixes #8555
@dragonstyle dragonstyle added this to the v1.5 milestone Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport bug Something isn't working websites Issues creating websites
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants