Problem/Motivation

The layout builder UI, and details of the sections/regions/blocks currently arrangemed inside it, needs to be conveyed to assistive tech users.

Because before a user starts to add/move/delete blocks, they need to know what is there already.

Proposed resolution

Important: these ideas are not mutually exclusive. A balanced combination of all of them might be the most useful.
TODO: Any other approaches we can consider?

Idea 1 - ARIA group role(s) with associated label

This enables a screen reader user to understand what sort of group they have entered, when they are traversing the document using the screen reader in normal browse/read mode, or tabbing through interactive controls.

  • Add <div role="group" aria-labelledby=""> grouping wrappers, to name the available sections and regions. Each layout region, and each layout section, gets a group role.
  • The accessible name could derive from the *.layouts.yml layout plugin definitions. There are human-readable names for the layout itself (2 column 25%/75%), and the regions inside it (left, right).
  • Sections don't have names, so we'll have to describe these using their number (position-in-set) to distinguish them, i.e. "Section 2."
  • The layout plugin's name could also be used, but it may not be unique so we'd append it to the numbered section label, e.g.. "Section 2 - two-column layout 25%/75%". Not sure if that belongs in the section's accessible name, or an accessible description (see idea 2)
  • Which ARIA container role should be used? Group, section, and region are all possibilities. Note that "region" means a landmark region, and "section" is equivalent to the HTML5 <section> element.

Idea 2 - headings associated with layout section, layout region, and layout block

This enables the layout builder to be navigated using the screen reader's document outline tools. Seriously useful, so a should-have triage.

  1. A nested heading element inside each layout section, layout region, and layout block
  2. Heading levels: section is H2, region is H3, block is H4.
  3. For this stage, the accessible names of the role="group" container will ideally come from an aria-labelledby relationship to the heading element.
  4. The headings could be hidden (display: none), .visually-hidden, or even visible (display: block). TODO: use cases for each?
  5. Visible block names are necessary for #2959493: Allow Layout Builder live previews to be toggled to allow easier drag-and-drop. These could double as the block's H4, and the toggle would make them visible.
  6. Allowing users to make section and region names visible could help in several circumstances. Colleagues discussing the layout, authors and themers who are interested in the responsive re-flow, and some screen magnifier users may use them as signposts in a restricted viewport. Some sketches of this were discussed with andrewmacpherson, tedbow, and the UC Berkely Web Access team. TODO: needs child issue, dig out these details.

Idea 3 - ARIA group role(s) with accessible description

Expanding on idea 2, we could add use aria-describedby to provide a brief summary of what's going on inside each layout section and/or layout region. This provides extra context. Triage as nice-to-have.

  1. The summary could be granular, with a summary per section, per region, as well as one at the start of the entire layout builder UI.
  2. Nest an hidden text summary inside the start of each layout section (and layout region), with some important summary information <div role="group" aria-labelledby="" aria-describedby="">
  3. This summary information would be somewhat like the approaches for describing tables using caption and summary.
  4. Layout plugin *.layouts.yml declarations also provide a human-readable "description" field property, but it is optional. Is this a good way to use the description? We could include this in a section's summary.
  5. A description for the region group could state the number of blocks currently contained inside.
  6. Example for a layout section: A section has an accessible name "Section 2", and the accessible description "3 column layout, 25%/50%/25%"
  7. Example for a layout region: A region has an accessible name "Left region", and the accessible description "Contains 3 blocks."
  8. Question: which information should go in the accessible name, versus the accessible description? For example the fact that section 2 has a 3 column, 25%/50%/25% layout.

Overall markup

If we combine all 3 ideas, we'll have something like this:

<div role="region" aria-labelledby="section-1-label" aria-describedby="section-1-desc">
  <h2 id="section-1-label" style="display:none;">Section 1</h2>
  <span id="section-1-desc" style="display:none;">2 column, 25% 50% 25%.</span>

  <div role="region" aria-labelledby="section-1-region-1-label" aria-describedby="section-1-region-1-desc">
    <h3 id="section-1-region-1-label" style="display:none;">left region</h3>
    <span id="section-1-region-1-desc" style="display:none;">contains 3 blocks</span>

    // ... blocks have h4
    
  </div><!-- /region -->
</div><!-- /section -->

Remaining Questions, Challenges, and Opportunities

  1. Headings are commonly used as the main navigation method by screen reader users. If the layout builder UI makes use of visually-hidden headings, but the block content also contains headings, will these two sets of headings be working at cross-purposes?
    • Possible solution: allow screen reader users to hide the block content previews. In #2959493: Allow Layout Builder live previews to be toggled to allow easier drag-and-drop, we provide a way for users to hide the block content. The initial use case for this was to help sighted pointer users with drag/drop, where large blocks made drag/drop difficult. However it has the bonus effect of hiding the headings which are nested inside block content, so screen reader users can concentrate on the headings which describe the layout builder UI itself.
  2. The terms "section" and "region" already have special meanings in HTML5 and ARIA, and they may be announced as roles by screen readers. Will this be a problem? Will it suffice if we choose our labels carefully, like "Layout section 1, left region".
  3. Verbosity - how much of this is necessary, vs. nice-to-know, vs. way too much?
  4. The ARIA 1.1 roledescription may eventually be useful here, to override role="group". However it is leading-edge feature, not broadly implemented yet. For example we might eventually be able to say <div role="group" roledescription="Layout region">
  5. Are the accessible name and description intended solely for assistive tech, or should all users be able to access them somewhere?
  6. Should modules be allowed to alter the accessible description? Is an alter hook warranted for that? This might be a bit like the hook_field_formatter_settings_summary_alter()

Remaining tasks

Get opinions from screen reader users in the community, and/or expert advice (walk-throughs, prior art) from wider a11y community.
Implementation.

User interface changes

Markup changes, primarily hidden (and/or visually hidden, not clear which yet...) labels and descriptions for screen readers. No visual changes required to support screen readers, but see other accessibility issues which may toggle these between hidden (or maybe visually-hidden) and visible.

API changes

TBD

Data model changes

TBD

Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

Issue summary: View changes
andrewmacpherson’s picture

Priority: Normal » Major
Issue tags: -Accessibility +accessibility
tim.plunkett’s picture

Issue tags: -accessibility (duplicate tag) +Accessibility

Fixing tag

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andrewmacpherson’s picture

Status: Active » Needs work
Issue tags: +Needs issue summary update

quick brain dump, will elaborate later....

Discussed on slack a while back with cboyden, about whether role=group or role=region would be better....

  • The latter would be included in landmark navigation for assistive tech, which sounds like it could be a useful shortcut.
  • However this has serious cons too; we we concerned this could mean far too many landmarks, because there is no limit to the number of sections/regions in layout builder (the Landing page use case would be particularly affected)
  • I'm concerened that it isn't generally a good idea to dynamically add/remove landmark regions to a page. Users will need to reorientate themself every time you want to find a static landmark like the layout builder tools region proposed in #2917777: Improvements to the styling, grouping, etc. of the Layout Builder UI actions form.

Another idea would be to use visually-hidden headings as a way for users navigate the layout builder. However this has a huge snag too: the content previews for blocks can also contain headings (headings from block templates, or from rich text fields). So there would be TWO sets of headings interwoven with each other.

andrewmacpherson’s picture

Issue summary: View changes
andrewmacpherson’s picture

Issue summary: View changes

big issue summary update, organise different ideas better.

andrewmacpherson’s picture

Issue summary: View changes
andrewmacpherson’s picture

Issue summary: View changes
Issue tags: +Layout Builder stable blocker

This should be a stable blocker. It was already the child of a stable blocker, this should be clearer.

webchick’s picture

Thanks so much for all the detailed recommendations here! Definitely a lot to work from there, and really appreciate everyone's effort to drive toward solutions.

What I'm hearing from the Layout team is that this issue being marked as a stable blocker (as opposed to a later major accessibility improvement) could be the difference between this feature shipping in 8.7 and not. (The team didn't realize that this issue was considered one of the stable requirements until it was tagged today, and there are only six more working days before the final deadline for 8.7 features at the end of next week. EEK!)

From a product management POV, this feature is absolutely critical for Drupal. So I want to make sure we're on the same page here regarding the definition of "stable blocker." This would basically be issues that would meet our definition of critical. (For example, the content is completely missing for a screen reader.)

Does that apply in this case? And if so, of all the things outlined in the issue summary, what is most important/critical? Are there particular points that are worse than others, or that are more direct WCAG/ATAG 2.0 violations than others? If so, we could prioritize effort on fixing the worst problems first.

And just to note, as verified with @xjm: any accessibility issues that we don't have actionable solutions for yet, or other bugs that we find, are still at least "major" bugs that in most cases we'll commit and backport up until the release candidate, as well as in any subsequent patch release after 8.7.0. (Accessibility issues are one of the few reasons that we'll break stable frontend code, for example.)

andrewmacpherson’s picture

Issue summary: View changes

Thanks @webchick. I've made a longer comment about how I'm approaching the gate assessment, over at #3007978-35: Accessibility Plan for Layout Builder. The earlier comment at #3007978-21: Accessibility Plan for Layout Builder is also worth reading. That's the one the WordPress Tavern journalist picked up on in the autumn.

The issue summary here has a lot of detail, which makes it look big and scary. The detail is just me working out the plan as a technical concept, that was the hard bit.

Actually implementing this could be rather easy. We should do them all, but I've swapped the numbers around to indicate the priority. These can be carried out in stages.

The accessible names for the groupings (section, region, block) can come from aria-labelledby or aria-label. The former is preferable, as it sets us up for other cool features like a toggle preference to "show section and region names".

At the minimum, we can achieve idea 1 by whacking role="group" and aria-label attributes onto the wrapper DIV for each layout section, layout region, and layout block. The text can be derived from layout information that is already available, mentioned in the details.

Idea 2: adds headings, and enables the layout builder to be navigated using the screen reader's document outline tools. Tremendously handy, hence it's a should-have. Also sets us up for another cool feature: a toggle preference to "show section and region names".

Idea 3: accessible descriptions add some useful context, paints a richer picture of where you are. Nice to have.

Next steps:
Split this into a 3-issue plan by must/should/nice triage.
I can provide specimen markup (pseudocode/twig) to illustrate the desired markup.

xjm’s picture

Title: Describe layout builder UI to assistive technology. » [plan] Describe layout builder UI to assistive technology
Category: Task » Plan
Status: Needs work » Active

Thanks @andrewmacpherson -- identifying the must/should/could will be very helpful, as would pseudocode.

I'm converting this to a plan issue since there are several distinct fixes, and setting active since there's no patch. Hope that makes sense!

tim.plunkett’s picture

Opened #3041143: Add ARIA group roles to Layout Builder UI as the actionable stable blocker for this plan issue, it lists this issue as a parent

rainbreaw’s picture

I know I saw this elsewhere, but not in this comment list: just want to clarify the difference between

  • aria-label: use this if there is no visible content on the page that will be used as the label - this should be a sort sentence, and would be treated sort of like alt text (please keep it short)
  • aria-labelledby: use this include an ID that references a span, div, or other that contains short text that would be the label for element. It should be short! Think alt-text. Example code: <h3 id="#awesomelabel">Awesome label!</h3><something aria-labelledby="awesomelabel">
  • aria-describedby: should also reference something visible on the page, but would be for longer text (e.g., anything longer than 125 characters, which is where JAWS gets wonky for labels and alt-text). It also uses the ID method, like labelledby.

For details: https://w3c.github.io/using-aria/#label-support

aaronmchale’s picture

From IS:

Sections don't have names, so we'll have to describe these using their number (position-in-set) to distinguish them, i.e. "Section 2."

My comment on #2995689-113: Allow reordering blocks without a pointer device could be relevant here:

Not long ago in Slack, someone asked if Sections have the ability to specify a name/description, which got me thinking that perhaps if (in a follow-up issue) we introduced the concept of a standard Section name/title/description optional field, perhaps we could use that to enhance the Section/Region selection list introduced here.

I can definitely see why some people might find it easier to locate the correct Section and Region if the Sections were named in a way that made sense to that particular page, rather than simply just "Section 1", "Section 2", etc. Plus if the Section name/title/description value was displayed above each Section and used when describing each Section to screen readers and other assistive technology then that might also further improve the accessibility of Layout Builder.

tim.plunkett’s picture

As #3007978: Accessibility Plan for Layout Builder is an existing plan issue and #3041143: Add ARIA group roles to Layout Builder UI was committed as an implementation of this issue, I am removing the stable blocker tag.

andrewmacpherson’s picture

Today the UC Berkeley Web Access team held a screen reader walkthrough of layout builder. They hit some issues which the proposals here already speculated about! So there is some useful insight about which direction this plan can go.

Some points from the walkthrough, and my assessment of them:

  1. The user attempted to find layout sections using the screen reader's landmark regions tool. They couldn't find a layout builder section that way.
    • Idea 1 in the issue summary considered this; whether it would be better to treat sections as role="group" (not a landmark) or role="region" (classed as landmark). The worry about using landmarks, is that there's a consensus in the a11y community that you shouldn't have too many of them (a dozen would be a lot). Using layout builder for landing pages could easily lead to a lot of landmarks. We eventually erred on the side of role="group" in #3041143: Add ARIA group roles to Layout Builder UI.
    • However the screen reader walkthrough today told us that using landmark regions might not be a bad idea after all.
    • Good news: changing from role="group" to role="region" is an easy semantic change, and I don't expect any side-effects with styling or behaviour.
  2. When using the landmark regions tool, they did find a lot of unlabelled "form" regions, and wondered if these identified sections, in which case they should be labelled.
  3. When encountering a LB section, they would like to know what layout it has. You're told that you have reached a section ("section 2") but not how many column regions it has. As they continued to explore, the region names were announced. They user said it would be helpful to know how many columns a layout has when they first encounter it. The region names don't convey the width either (just "left", say).
    • Idea 3 in the issue summary addresses this with the use of an accessible label and description for each section. The session today lends weight to something we triaged as a nice-to-have.

This isn't all we learned in the walkthough. The UC Berkeley team say they will share some notes later.

andrewmacpherson’s picture

Issue summary: View changes

Added specimen markup to illustrate this plan.

andrewmacpherson’s picture

Issue summary: View changes

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mgifford’s picture

Issue tags: +vpat

Linking open issues from the CivicActions Accessibility - VPAT.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mgifford’s picture

Issue tags: -vpat

Plans don't need to be included in a VPAT

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.