Problem/Motivation
When using patterns/components as Layout Builder sections, the preview and rendering of empty component may not be intuitive for a site builder to know in which region a block will be placed.
Currently, there are some hidden text in the link text for assistive technology but when not using such tools, "Add block" links are the same for the site builder.

Proposed resolution
Update the link text.
'#title' => $this->t('Add block in region @region <span class="visually-hidden">of section @section</span>', ['@section' => $section_label, '@region' => $region_labels[$region]]),

Remaining tasks
Agree on a new title.
User interface changes
Layout Builder add block link text change.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | Screenshot 2024-07-13 150523.png | 30.75 KB | danielveza |
| #9 | drupal-3460462-9.patch | 2.93 KB | grimreaper |
| Capture d’écran du 2024-07-10 11-11-11.png | 26.38 KB | grimreaper | |
| Capture d’écran du 2024-07-10 11-11-00.png | 33.28 KB | grimreaper |
Issue fork drupal-3460462
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
grimreaperAttaching patch for Composer usage.
Comment #4
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
Comment #5
pdureau commentedThe little change we are waiting for so long. Thanks you so much.
However, you replaced:
By:
Knowing than
@sectionis build like that:$layout_settings['label'] ?? $this->t('Section @section', ['@section' => $delta + 1]);I would move "region" because it is obvious for sighted people and visually impaired people have the additional wording, and skip "section" because already part of the label:
Comment #6
grimreaperComment #7
grimreaperThanks for the quick feedback.
I have updated the MR.
In the original title, there is no space after the end of the opening span tag, so resulting in:
And not:
Comment #8
pdureau commentedOK for me :)
Comment #9
grimreaperI guess you wanted to RTBC :)
New patch.
Comment #10
pdureau commentedComment #11
danielvezaThanks for raising an issue! This would need test coverage before it is can be moved to RTBC.
I'm not entirely convinced it is a better UX than the existing setup, but I'd be interested in hearing others opinions on it too
Comment #12
danielvezaComment #13
pdureau commentedHi Daniel,
Indeed, in the screenshot you uploaded as an example, the improvment is is not very visible, because the region are called "First", "Second", "Third"...
In the opposite side of the spectrum, you have thos example (each region is a slot of a Bootsrap card) which is unusable without this patch: