fix: #3625285 Render a heading on the views pages Canvas leaves without one

Fixes #3625285: Views and taxonomy pages render with no h1, because the page title is only available as a Canvas component

What was wrong

Educare renders through Drupal Canvas, so the page is built by CanvasPageVariant, not by the block layout. Core's page-title block never runs: the theme's config/optional/block.block.vartheme_bs5_educare_page_title.yml is not even installed, and placing it by hand changes nothing, because Canvas bypasses every region but the main-content one.

Canvas pages carry their own h1 as a heading component inside the page tree, so /, /about, /news, /programs and every node page were fine. Every views page display was not. Measured anonymously before the change, 19 routes rendered with no h1 at all and started at h3:

  • /events/upcoming, /events/past
  • 17 taxonomy term pages (/taxonomy/term/3, 11, 13, 16–22, 24–30)

What this changes

The fix is recipe config, not theme code: under Canvas there is no block to place and no theme template that can know a route's title, but a views display can carry its own heading. Both views already exist, so both are config actions, not files.

  • views.view.events — page_1 and page_2 each take their own header, with the title as the first area and the result counter they previously inherited from the default display kept after it.
  • views.view.taxonomy_term — the default display's header renders the term name through the argument's own {{ arguments.tid }} title token, the same token the view already uses for its page title.

Verification

On a Drupal CMS + Educare install, anonymously, across 101 reachable routes:

before after
routes with exactly one h1 82 101
routes with no h1 19 0
axe-core 4.13.0 violations (wcag2a, wcag2aa, wcag21a, wcag21aa, wcag22aa) 0 0

/events/upcoming renders <h1 class="h2">Upcoming Events</h1> followed by Showing 1-12 of 24; /taxonomy/term/3 renders <h1 class="h2">Community</h1>.

Proven from scratch, not only on a running site: drush site:install recipes/educare on a dropped database completes, and all three routes come up with exactly one h1 on that fresh install. Core's own entity_taxonomy_term header area is kept alongside the new one, because simpleConfigUpdate replaces the header map rather than merging into it and dropping it would have removed the rendered term entity.

Remaining tasks

  • ➖ The 19 listing pages now go h1 → h3, because their cards come from shared Canvas content templates (node.event.text_card_medium, node.*.card) whose heading_level is h3 — correct where those same view modes are embedded on a Canvas page under an h2 section heading, but one level too deep on a listing whose only heading above them is the page title. axe does not flag it under the WCAG tags above (heading-order is a best-practice rule), and it is strictly better than the previous state, where the page began at h3 with no h1 at all. Worth a follow-up issue about a per-display heading level.
  • ➖ /taxonomy/term/23 returns HTTP 500 (InvalidArgumentException: $string ("1") must be a string). Confirmed pre-existing and unrelated: it still 500s with this change reverted.

Checkpoints

  • File an issue
  • Fix: An issue that fixes a bug
  • Reviewed by a human
  • Code review by maintainers

AI-Generated: Yes

Edited by Rajab Natshah

Merge request reports

Loading
Loading