Problem/Motivation

When a page is rendered with display_builder_page_layout instead of Core's Block Layout, the html.html.twig template is kept but the page.html.twig is skipped.

Each Page Layout entity is initialized (BuilderDataConverter) with a copy of the front theme's page.html.twig (as PageLayoutSource) but the builders are invited to remove it and build they own.

However, if they remove PageLayoutSource they loose:

    <div class="visually-hidden"><a id="main-content" tabindex="-1"></a></div>

which is the anchor of html.html.twig's:

    <a href="#main-content" class="visually-hidden focusable skip-link">
      {{ 'Skip to main content'|t }}
    </a>

This is the

Proposed resolution

A first idea would be to add a MainContentSkipSource plugin for slots, which is rendering the anchor.

However, we are creating a situation where at least MainContentSkipSource and PageLayoutSource must be present, but not both. To avoid having duplicated HTML ID in the display, do we raise a warning if both are present? It will be the opportunity to add a "check-up" mechanism and introduce the idea of "source tree rules", but we need to be careful not over-complicating thinks. Let's keep it simple.

Considering this, do we add it automatically in BuilderDataConverter? If yes, do we show it in the BlockLibrary?

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Title: Add a » Accessibility: Add a MainContentSkipSource plugin?
pdureau’s picture

mogtofu33’s picture

mogtofu33’s picture