Problem/Motivation

On admin/config/regional/translate the four focusable elements (string contains, translation language, search in and the filter button) inside the filter translatable string fieldset miss the left border of the focus outline - or maybe it is covered by another element.

string contains field missing the left outline border
translation language selectbox missing the left outline border
search in selectbox missing the left outline border
filter button missing the left outline border

*Tested with Safari 13.1.2 and Firefox 97.0.1 on MacOS 10.13.6

Steps to reproduce

- Install the Language and the Interface Translation module
- Add a second language
- Go to admin/config/regional/translate

Comments

rkoller created an issue. See original summary.

tinto’s picture

This issue appears in Chrome v101 too.

It is caused by a single CSS property located in core/modules/locale/css/locale.admin.css, lines 1 to 3:

.locale-translate-filter-form .details-wrapper {
  overflow: hidden;
}

If you disable line 2, the focus outline works correctly. However, this causes other elements to misbehave: the filter and reset buttons will appear outside of the parent. This is because they have a float applied to them so the parent div does not stretch enough to contain floating child elements (a.k.a. the 'clearfix' problem). I don't understand why the form action buttons need a float to begin with.

Additionally, the overflow: hidden; also disables margin collapse, causing double margins. If you look at the space between Filter translatable strings and the String contains label, and compare it to for example /admin/config/system/site-information, you can see that there is too much margin. Disabling the line mentioned above also fixes this problem.

tinto’s picture

Component: Claro theme » locale.module

I can try to cook up a patch to fix this but I will need some more time to examine what is the common way Drupal core handles this part:

If you disable line 2, the focus outline works correctly. However, this causes other elements to misbehave: the filter and reset buttons will appear outside of the parent. This is because they have a float applied to them so the parent div does not stretch enough to contain floating child elements (a.k.a. the 'clearfix' problem).

I'd say there are two options to solve this at the core.locale level:

  1. 'clearfix' the parent element
  2. replace the child elements floats with a flexbox solution

P.S. Changing the issue component from 'Claro theme' to 'locale.module'.

tinto’s picture

Issue tags: +Bug Smash Initiative, +Accessibility
StatusFileSize
new612 bytes

Here's a patch that seems to solve this issue. Tested this for both Claro and Seven admin themes in Chrome, Firefox, Brave and Safari on Mac OS.

Background info:

The patch basically removes this css:

.locale-translate-filter-form .details-wrapper {
  overflow: hidden;
}

and adds a 'clearfix':

.locale-translate-filter-form .details-wrapper:after {
  display: table;
  clear: both;
  content: "";
}

Adding class clearfix to the .details-wrapper div would render the exact same result, but it seems that the classes for this element are applied at theme level, not by the core.locale module. So, IMO it feels more solid to solve this at the module level, instead of having to alter details.html.twig for each affected theme (i.e. Claro).

If anyone disagrees with this approach, please feel free to chime in.

lendude’s picture

Status: Active » Needs review
tinto’s picture

StatusFileSize
new248.74 KB

Adding a screenshot with a before/after comparison for patch in #4 in Claro theme (Chrome v101 on MacOS).

smustgrave’s picture

Tested and seemed to work for me.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

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.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: 3266123-4-9.4.x.patch, failed testing. View results

lendude’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated fail

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: 3266123-4-9.4.x.patch, failed testing. View results

lendude’s picture

Status: Needs work » Reviewed & tested by the community

More unrelated fails

larowlan’s picture

Status: Reviewed & tested by the community » Needs review

If adding the clearfix class resolves this, is there any reason why we can't add it to the details element using '#attributes'?

i.e.

$form['filters'] = [
      '#type' => 'details',
      '#title' => $this->t('Filter translatable strings'),
      '#open' => TRUE,
      '#attributes' => ['class' => ['clearfix']],
    ];

And then we can just remove the offending line of css without adding anything else?

smustgrave’s picture

StatusFileSize
new627 bytes

So something like?

larowlan’s picture

Status: Needs review » Needs work

Yes, but we still need to remove this bit of css that causes the original issue

.locale-translate-filter-form .details-wrapper {
		- overflow: hidden;
}

If you can do that and verify the original problem is fixed (adding some screenshots would be neat), I think we're golden

smustgrave’s picture

Status: Needs work » Needs review
StatusFileSize
new96.38 KB
new92.62 KB
new1.08 KB
new373 bytes

No problem

amber himes matz’s picture

Status: Needs review » Reviewed & tested by the community

- Followed steps to reproduce and verified issue
- Applied patch in #17, cleared caches, and verified issue is resolved -- all 3 fields in the form now have left border visible after patch applied
- Verified before/after PNGs in #17
- No notes on code (LGTM)

  • larowlan committed 1807b67 on 10.1.x
    Issue #3266123 by smustgrave, tinto, rkoller, Lendude, larowlan, Amber...

  • larowlan committed beb9503 on 10.0.x
    Issue #3266123 by smustgrave, tinto, rkoller, Lendude, larowlan, Amber...
  • larowlan committed 9a1577e on 9.4.x
    Issue #3266123 by smustgrave, tinto, rkoller, Lendude, larowlan, Amber...
  • larowlan committed 089a4e8 on 9.5.x
    Issue #3266123 by smustgrave, tinto, rkoller, Lendude, larowlan, Amber...
larowlan’s picture

Version: 9.5.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks for the fast turnaround folks.

Committed to 10.1.x, backported to 10.0.x and 9.5.x

Because the risk of regression is low here and this is a user-facing issue, backported to 9.4.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.