Use visually-hidden on title block instead of access false

Created on 27 April 2025, 20 days ago

The title block should be hidden with the .visually-hidden class so that the H1 element is always on the page.

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States mortona2k Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mortona2k
  • Merge request !15Visually hide title block → (Open) created by mortona2k
  • Pipeline finished with Success
    20 days ago
    Total: 277s
    #482907
  • 🇺🇸United States mortona2k Seattle
  • 🇮🇳India sagartiwari

    I am reviewing this.

  • 🇮🇳India sagartiwari

    I have reviewed the changes from MR #3 and can confirm that the issue is successfully resolved. The title block now uses the .visually-hidden class as expected, ensuring the H1 remains on the page while being hidden visually.
    Everything looks good to me!

  • 🇺🇸United States smustgrave

    Think this may need more thought. What if I'm using as a block now I get more H1s on the page.

  • 🇺🇸United States mortona2k Seattle

    @smustgrave, can you clarify what you mean?

    I think in most cases, the title block is the single H1 on the page, and this is a viable solution for that case. But I'm not sure how to handle any others.

    I thought about making a separate module for this, since the use case is so specific (although I think it's by far the most common).

  • 🇺🇸United States smustgrave

    Need to play around with it but I would assume if someone is using this module it's because they are displaying the page title in another way, like a hero banner. Or could using the content type the exclude field is on as a block on another page.

    The first scenario I know I've done and this would make multiple H1s appear for a screen reader now. Maybe there needs to be a 2nd checkbox added. So if you check exclude title, a 2nd appears asking if you want to visually hide it, then we do your approach.

  • 🇺🇸United States mortona2k Seattle

    I see what you mean. However, if I was displaying the page title as an H1 in a separate hero block, I would disable the title block on that page entirely, so only one h1 exists in the html.

    There's different ways to set up a page with a hero, but many of them are going to cause a disconnect between where you see the exclude node title checkbox, and where else the title can be displayed (which will take some manual config anyway).

    There could be a situation where the hero is a display mode of the current page, placed as a block in a page region. What does the exclude node title option do in this case?

    The two step option to choose between hiding and visually hiding could work, but I'm not sure if it covers all the ways we'd want to manage this.

Production build 0.71.5 2024