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.

Issue fork drupal-3460462

Command icon 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

Grimreaper created an issue. See original summary.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Active » Needs review
StatusFileSize
new1.46 KB

Attaching patch for Composer usage.

needs-review-queue-bot’s picture

Status: Needs review » Needs work

The 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.)

pdureau’s picture

The little change we are waiting for so long. Thanks you so much.

However, you replaced:

Add block <span class="visually-hidden">in @section, @region region</span>

By:

Add block in region @region <span class="visually-hidden">, section @section</span>

Knowing than @section is 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:

Add block in @region <span class="visually-hidden"> region, @section</span>
grimreaper’s picture

Assigned: Unassigned » grimreaper
grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Needs work » Needs review

Thanks 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:

Add block in @region <span class="visually-hidden">region, @section</span>

And not:

Add block in @region <span class="visually-hidden"> region, @section</span>
pdureau’s picture

Status: Needs review » Needs work

OK for me :)

grimreaper’s picture

StatusFileSize
new2.93 KB

I guess you wanted to RTBC :)

New patch.

pdureau’s picture

Status: Needs work » Reviewed & tested by the community
danielveza’s picture

StatusFileSize
new30.75 KB

Thanks 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

Layout builder screenshot showing the new block text

danielveza’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests
pdureau’s picture

Hi Daniel,

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

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:

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.