Problem/Motivation

While working on tests in #3393400: Implement Nightwatch tests for Navigation module. I could not click any links inside of the admin toolbar. It turns out it is due to .admin-toolbar__scroll-wrapper having display: contents;

I went to Can I Use and found there are problems with display: contents; in all major browsers: https://caniuse.com/?search=display%3A%20contents

Buttons are not accessible with display: contents applied. See issues for Chromium, Firefox, and WebKit

Steps to reproduce

I haven't manually reproduced by trying to tab and focus on buttons.

See https://issues.chromium.org/issues/40866683 with a non-Drupal example.

Proposed resolution

Remove display: contents;

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3446357

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

mglaman created an issue. See original summary.

mherchel’s picture

The Chromium issue above is slightly different. It deals with setting display: contents directly on the <button>, which is not what we're doing.

From what I see, we're only applying it in one place on .admin-toolbar__scroll-wrapper

I'll investigate a bit more.

mglaman’s picture

Status: Active » Needs review

Opened an MR that wholesale removes it, not sure the consequences

mglaman’s picture

@mherchel, you're right. I took https://cdpn.io/aardrian/debug/NWqbggX and but the button inside of a div with display: contents. Maybe it's a bug in Chromedriver itself?

mglaman’s picture

Status: Needs review » Needs work

I found https://github.com/SeleniumHQ/selenium/issues/6977 and their fix https://github.com/SeleniumHQ/selenium/commit/bbdf7c28a14645c3f5c53f2492...

      if (goog.string.startsWith(containerDisplay, 'inline') ||
          (containerDisplay == 'contents')) {

I don't exactly know the way forward, but it shows the fix is not removing display: contents but investigating the test issue

mglaman’s picture

I've also found https://github.com/angular/protractor/issues/4951. There is no solution but some details to the problem.

Finally getting a chance to come back to this, and I was able to chisel it down quite a bit, and I've found that it's a combination of two style declarations: display: contents with overflow: hidden.

We're in that situation with

  overflow-x: hidden;
  overflow-y: auto;
mglaman’s picture

This failed

.admin-toolbar__scroll-wrapper {
  display: flex;
  /*overflow-x: hidden;*/
  overflow-y: auto;

@media (min-width: 64rem) {
  .admin-toolbar__scroll-wrapper {
    display: contents;
    background: none;

This also failed

.admin-toolbar__scroll-wrapper {
  display: flex;
  overflow-x: hidden;
  /*overflow-y: auto;*/

@media (min-width: 64rem) {
  .admin-toolbar__scroll-wrapper {
    display: contents;
    background: none;

This passed.

.admin-toolbar__scroll-wrapper {
  display: flex;
  /*overflow-x: hidden;*/
  /*overflow-y: auto;*/

@media (min-width: 64rem) {
  .admin-toolbar__scroll-wrapper {
    display: contents;
    background: none;

So it is not display: contents;. Only in combination with overflow

mglaman’s picture

Status: Needs work » Needs review

Marking for review, I have no idea the impact of the overflow. But from I've read, it isn't needed.

mglaman’s picture

Issue tags: +Portland2024
gauravvvv’s picture

Status: Needs review » Needs work
StatusFileSize
new110.84 KB

Removing overflow-y: auto; is having impact on design in mobile devices. See screenshot for reference.

gauravvvv’s picture

Status: Needs work » Needs review
mglaman’s picture

Found another report of this combo failing tests with Cypress: https://github.com/cypress-io/cypress/issues/25199

mglaman’s picture

@Gauravvvv thanks for adding a fix! I'll copy it to a test I have to verify it makes WebDriver happy

finnsky made their first commit to this issue’s fork.

finnsky’s picture

Status: Needs review » Reviewed & tested by the community

I've tested. seems all fine.

mglaman’s picture

@finnsky did you re-run the linked Nightwatch test? Or manually test.

finnsky’s picture

Nope. I just checked for regressions in tugboat instance

mglaman’s picture

Status: Reviewed & tested by the community » Needs review

Okay, going to move to NW because this all kicked off since it's not accessible when testing with WebDriver and that needs to be verified. I'll be at a computer soon

mglaman’s picture

🙌 the Nightwatch test passed locally for me with these changes. I copied them over to #3393400: Implement Nightwatch tests for Navigation module, waiting to double verify with pipeline https://git.drupalcode.org/issue/drupal-3393400/-/pipelines/169765

smustgrave’s picture

@mglaman should this be Needs work per #19?

mglaman’s picture

The test passed with this added before the a11y test was added there. It's a horrible chicken and egg problem of "What do we fix where?" We could fix this with the tests, but it seems like it should be its own fix. As far as I can tell, this issue fixes the visibility bug and can be RTBC'd and unblock testing the new Navigation module.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Sounds good.

nod_’s picture

Title: Buttons are not accessible with display: contents applied » Fix overflow visibility for wrapper content in navigation CSS

updating title

  • nod_ committed 2fffa8f3 on 10.3.x
    Issue #3446357 by mglaman, Gauravvvv, finnsky, smustgrave, mherchel: Fix...

  • nod_ committed 8ac88322 on 10.4.x
    Issue #3446357 by mglaman, Gauravvvv, finnsky, smustgrave, mherchel: Fix...

  • nod_ committed 87ae449b on 11.0.x
    Issue #3446357 by mglaman, Gauravvvv, finnsky, smustgrave, mherchel: Fix...

  • nod_ committed cdc8135c on 11.x
    Issue #3446357 by mglaman, Gauravvvv, finnsky, smustgrave, mherchel: Fix...
nod_’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed cdc8135c56 to 11.x and 87ae449bf4 to 11.0.x and 8ac8832201 to 10.4.x and 2fffa8f31d to 10.3.x. Thanks!

Status: Fixed » Closed (fixed)

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