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.ymllayout 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.
- A nested heading element inside each layout section, layout region, and layout block
- Heading levels: section is H2, region is H3, block is H4.
- For this stage, the accessible names of the
role="group"container will ideally come from an aria-labelledby relationship to the heading element. - The headings could be hidden (
display: none),.visually-hidden, or even visible (display: block). TODO: use cases for each? - 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.
- 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.
- 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.
- 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=""> - This summary information would be somewhat like the approaches for describing tables using caption and summary.
- Layout plugin
*.layouts.ymldeclarations 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. - A description for the region group could state the number of blocks currently contained inside.
- Example for a layout section: A section has an accessible name "Section 2", and the accessible description "3 column layout, 25%/50%/25%"
- Example for a layout region: A region has an accessible name "Left region", and the accessible description "Contains 3 blocks."
- 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
- 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.
- 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".
- Verbosity - how much of this is necessary, vs. nice-to-know, vs. way too much?
- The ARIA 1.1
roledescriptionmay eventually be useful here, to overriderole="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"> - Are the accessible name and description intended solely for assistive tech, or should all users be able to access them somewhere?
- 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
Comment #2
andrewmacpherson commentedComment #3
andrewmacpherson commentedComment #4
tim.plunkettFixing tag
Comment #6
andrewmacpherson commentedquick brain dump, will elaborate later....
Discussed on slack a while back with cboyden, about whether role=group or role=region would be better....
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.
Comment #7
andrewmacpherson commentedComment #8
andrewmacpherson commentedComment #9
andrewmacpherson commentedbig issue summary update, organise different ideas better.
Comment #10
andrewmacpherson commentedComment #11
andrewmacpherson commentedThis should be a stable blocker. It was already the child of a stable blocker, this should be clearer.
Comment #12
webchickThanks 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.)
Comment #13
andrewmacpherson commentedThanks @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-labelledbyoraria-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"andaria-labelattributes 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.
Comment #14
xjmThanks @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!
Comment #15
tim.plunkettOpened #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
Comment #16
rainbreaw commentedI know I saw this elsewhere, but not in this comment list: just want to clarify the difference between
<h3 id="#awesomelabel">Awesome label!</h3><something aria-labelledby="awesomelabel">For details: https://w3c.github.io/using-aria/#label-support
Comment #17
aaronmchaleFrom IS:
My comment on #2995689-113: Allow reordering blocks without a pointer device could be relevant here:
Comment #18
tim.plunkettAs #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.
Comment #19
andrewmacpherson commentedToday 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:
role="group"(not a landmark) orrole="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 ofrole="group"in #3041143: Add ARIA group roles to Layout Builder UI.role="group"torole="region"is an easy semantic change, and I don't expect any side-effects with styling or behaviour.role="form"in contextual links module. We've already proposed removing this in #2873389: ARIA role="form" on contextual menu buttons is unnecessarily verbose and misleading for screen readers. I still think that's the right thing to do, as it's a problem everywhere contextual links are used. Using a customrole="region"landmark to wrap a section (in idea 1) would be more semantically correct than a form role on the contextual links menu.This isn't all we learned in the walkthough. The UC Berkeley team say they will share some notes later.
Comment #20
andrewmacpherson commentedAdded specimen markup to illustrate this plan.
Comment #21
andrewmacpherson commentedComment #25
mgiffordLinking open issues from the CivicActions Accessibility - VPAT.
Comment #30
mgiffordPlans don't need to be included in a VPAT