Skip to content

Accessibility, Translation and Hash-Links #11358

@Alex-Genovese

Description

@Alex-Genovese

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

The current hash-link setup causes endless problems when a page link is pasted into google translate

Try blog/releases/3.8 in french for example and you can see how that messes up the headings and sub-headings. Most of the title text ends up getting hidden and there are breaks in the middle.

The links in the side bar are fine. You can right click and copy link https://docusaurus.io/blog/releases/3.8#docusaurus-faster sans probleme.

I have done a lot of looking:

The links contained in #9222
ie, are-your-anchor-links-accessible
seem to have been formative to much of Docusaurus hash-link decision making, but this article does go on to say that is not a perfect answer and does go on to mention Google Translate problems, giving a link to here aria-label-is-a-xenophobe on the topic.

Now given that only 18% of the world speak English and that the sidebar produces perfectly satisfactory sublinks that can be copied, I think that an option to turn off the hash-link feature is something that is needed.

After seeing the comments to yet another hash-link problem here#10634 I came up with a workaround:

.hash-link {
  display: none;
}

.hash-link::before {
  display: none;
}

.hash-link:focus,
*:hover > .hash-link {
  display: none;
}

So, this an issue. The underlying fundamental issue may lie with Google or even with W3.org but it is still something that can be fixed easily here.

If people can test pasting this into custom.css and no-one has any problems with Mac Voice Over and other apps, and if Sébastien is okay with this, I'll write a PR for the Style and Layout Docs

Reproducible demo

No response

Steps to reproduce

https://docusaurus-io.translate.goog/blog/releases/3.8?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en&_x_tr_pto=wapp

Expected behavior

Try the translate button top right here https://qqxproject.org/docs/Translation

Actual behavior

Image

Hidden Title Text, in blue, only visible on mouse over. In some cases words are missing altogether.

Your environment

Latest Chrome, Firefox, Edge ...

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions