Problem/Motivation
Most available operations in the Layout Builder UI (adding a section, removing a section, configuring a section, adding a block, dragging and dropping a block) are always visible and require one click.

However, options to configure or remove a block are not visible by default. To discover and use them, the user must:
- Hover the cursor over the block.
- Click the pencil icon.
- Keep the cursor over the menu.
- Click on (e.g.) "Configure".

We used contextual links for these block operations because that's a pattern already used in core for configuring blocks from the frontend. However, the fact that the contextual links are hard to find compared to the other, intuitive operations available in the UI leads to various usability and accessibility problems, and even experienced Drupalists miss them. For example:
- I myself often click the button to delete a whole section when I actually only want to remove a block, even though I know that the contextual link is the only way to actually remove a block. Only the confirmation form we added recently stops me from accidentally deleting data all the time.
- Sometimes I click on the block expecting it to open the sidebar with the block configuration.
- The difficulty in locating the contextual links also resulted in #3037742: The toggle that makes Contextual Links visible at all times might not be sufficiently discoverable being filed as an accessibility issue for the Layout Builder.
Proposed resolution
- Add always-visible buttons to configure and remove blocks, similar to those available for sections?
- Make a single click on the block open the sidebar tray with its configuration form?
- Something else?
Remaining tasks
Needs discussion and design.
User interface changes
TBD
API changes
TBD
Data model changes
N/A
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| lb_contextual_links.png | 138.14 KB | xjm | |
| lb_operations.png | 209.77 KB | xjm |
Comments
Comment #2
xjmComment #3
xjmComment #4
andrewmacpherson commentedThe problem as I see it is that Layout Builder uses contextual module for something it wasn't built for. In other places that use contextual module, it just provides a convenience shortcut to something that can be achieved by using the main admin menu, e.g. a view can be configured by clicking "structure" then finding a link to views UI.
But the way layout builder uses contextual module, is that these visually-hidden buttons are the only way to achieve most tasks. You can't edit a custom LB "inline" block without it; those aren't shown in the block library, so there's no alternative route for the task.
The biggest accessibility impact of this is that speech control users cannot operate layout builder at all at present. Touchscreen users also face a barrier here, without a hover-capable pointer.
From the proposed resolution:
This will solve the problem for sighted users well. However we should bear in mind the number of tab stops for keyboard users. Currently there is one tab stop per block: the contextual menu button. If we split this into two buttons like the section controls, we greatly increase the number of keypresses needed to get anywhere (and that's before contrib starts adding extra operations...). I'd say it's preferable to keep the single-button menu pattern. Elsewhere I proposed using a single-button menu for the section controls too (in #3037779: Configure section and Remove section links interrupt the flow for keyboard users and are visually distracting).
Another problem is that enabling layout builder means that contextual module gets added as a dependency, and contextual links start appearing everywhere, just because layout builder needs them. (A lot of sites I have worked on don't use contextual links or quick edit modules; they just aren't enabled in our starter profile, and I expect that's true of many digital agencies.) So if we want to start using layout builder suddenly there will be lots of contextual menu links where there weren't before. For keyboard users that means that lots of pages suddenly get more laborious because of layout builder functionality elsewhere.
Comment #6
dqdSame for Quick Edit.
@xjm: I consider to open another child issue to this here for discussing the hard Quick Edit dependency of Layout Builder which makes it impossible to get Quick Edit out of the way for users, who don't want it but already use Layout Builder. My question is if we just merge it into this "re-evaluate" META issue or leave it seperately. Not sure yet ...
EDIT: After longer thinking about it I see 2 possible options to fix this, and one of them is not Layout Builder related, so maybe it becomes a separate one: We could extend the settings for Quick Edit to make it unvisible under certain conditions or we could discuss its usage and dependency on Layout Builder only. But I am not relly convinced that this should be solved from the Quick Edits side yet.
Comment #7
tim.plunkettLayout Builder has no dependency on Quick Edit. It provides rudimentary integration for Quick Edit, if you have both installed. But nothing about LB itself needs or wants QE.
Comment #8
dqdHey Tim! Thanks for chiming in. My assumption came from the fact that I wasn't able to disable Quick Edit if Layout Builder is enabled, but I feel sorry if this isn't true (no more) or is based on another issue. Let me test/reproduce what I was referring to. It is some weeks ago already.
Comment #10
bkosborne+1 to this. This is probably the biggest issue our users have with the UX of layout builder. The experience of editing a layout is very confusing especially for new users.
Comment #12
dqdFirst things first: To come back to #7 -> I mistakenly mixed up QuickEdit and Contextual Links dependency of LB, to clarify that confusion.
Now to my final thoughts on this: From what I see the conclusion I come to from it is that the problem with Contextual links in this issue here is only the tip of the iceberg. I think this needs to be discussed and fixed in a more general manner within Contextual links regarding the fact that is completely misses configuration options in admin UI. Added META [#3196068: Make Contextual links granular configurable and context aware] for that.
Comment #15
le72Agree with the author.
If I disable the contextual menu core module, I can't use the Layout Builder, can't edit, delete blocks.
Comment #16
xjmThanks @le72. I'm curious how you were able to even use Layout Builder without Contextual enabled, since Layout Builder does correctly declare a dependency on Contextual:
(If that dependency hadn't been there, this would actually be a critical bug.)
Comment #17
le72Well, I did say in theory.
But in that case another example: If for some role use contextual link access is disabled he/she can't use Layout Builder.
Comment #20
dalemoore commentedIt looks like it just uses the visually-hidden class to hide the pencil icon and removes that class on hover. Could we just always show the pencil icon instead, but set it to a low opacity (0.25-0.5) by default and on hover/focus it is opacity: 1? The little pencil icon doesn't take up much real estate and floats over everything as-is. I have more of an issue with that all block configuration happens in the sidebar. To me, only the section configuration should happen in the sidebar, and the block should popup in a modal. There's usually not enough room in that tray to edit fields, especially if it uses Paragraphs.
Comment #21
maskedjellybeanFYI @dalemoore in case you didn't know, there's a module that opens the block configuration in a modal: https://www.drupal.org/project/layout_builder_modal
I agree with you that a modal should absolutely be the default behavior for editing a block in layout builder (although I know this isn't the issue for it). I've never worked on a site where there's enough horizontal space in the sidebar for the fields on the block. All but the most basic field types look wonky.
Comment #22
mgiffordAdding for SC 2.1.1 https://www.w3.org/WAI/WCAG21/Understanding/keyboard