Problem/Motivation

About a week ago, I began noticing odd issues with styles in the settings tray. I have replicated the issue across multiple browsers (Chrome, Firefox, Safari on Mac. Chrome, Edge on Win 10) and at least three different Drupal projects, including a vanilla 8.9.13 instance I used to capture the examples below:

Example 1: Layout Builder - Section Layout Config
Incorrect text font, color. Incorrect SVG color makes layout icons invisible.

Layout Builder section layout select

Example 2: Layout Builder - Block Config
Unexpected compact spacing due to missing margin/padding. Incorrect font/colors. Summary for Details element ("Label Settings") displays "inline" instead of expected "block."

Layout Builder block config


One quick fix is to disable the all: initial declaration in off-canvas.reset.css (~line 16):

Disabling 'all: initial' in Layout Builder configure section
initial declaration

Here's a non-Layout Builder example of the result of disabling 'all: initial' when editing Menu Block settings in the settings tray.

This seems to work well everywhere I'm noticing problems. So, best guess is the problem is related to the rule that begins around line 12 of core/misc/dialog/off-canvas.reset.css (and/or core/themes/stable/core/dialog/off-canvas.reset.css):

#drupal-off-canvas *:not(div),
#drupal-off-canvas *:not(svg *),
#drupal-off-canvas *:after,
#drupal-off-canvas *:before {
  all: initial;
  box-sizing: border-box;
  text-shadow: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: initial;
}

I know this was added in #2826722: Add a 'fence' around settings tray with aggressive CSS reset., to prevent theme styles from 'leaking' into the tray, so seems like getting rid of all: initial probably not the solution.

That change landed some time ago, though, so I'm at a loss to explain why this only became an issue for me in recent days — unless all those browsers changed in some way recently.

I guess as much as anything, I'm posting this to see if anyone else is experiencing the same thing.

Comments

justcaldwell created an issue. See original summary.

justcaldwell’s picture

Issue summary: View changes

Minor IS edit.

justcaldwell’s picture

A quick update: after more testing, it seems this is related to recent browser updates. I noticed it recently because Chrome 88 was released on January 18. The issues do not occur on Chrome 87. The same is true for Edge — the problem occurs on 88 (released Jan 22), but not on 87, which makes sense given Edge and Chrome share a rendering engine.

For Firefox, the issues are present on the two most recent versions — 84 and 85 — but not version 83 and earlier.

Seems BrowserStack doesn't offer old version of Safari, so I'm not able to check there.

justcaldwell’s picture

Also, per Can I Use, Chrome 88 and Firefox 84 each added support for selector list arguments for :not(), so there were definitely changes to the rendering engine that would affect the CSS rule identified in the issue summary (which relies heavily on the :not() pseduo-class).

#drupal-off-canvas *:not(div),
#drupal-off-canvas *:not(svg *),
#drupal-off-canvas *:after,
#drupal-off-canvas *:before {
  all: initial;
  box-sizing: border-box;
  text-shadow: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: initial;
}
longwave’s picture

Thank you for the extremely detailed bug report and for digging into the problem.

This was already noted for Safari some time ago in #2958588: Off-canvas style resets are overriding styles (especially SVGs) resulting in display issues but has suddenly become a wider issue with the support for complex :not() selectors in Firefox 84 and now Chrome 88.

I am closing this issue as a duplicate of the above linked one but please feel free to repeat your findings over there, as the more detail we have the better chance we have of finding a good solution to this.

justcaldwell’s picture

Thanks for pointing me in the right direction!

blainelang’s picture

This issue was driving me crazy yesterday and it was so hard to find anyone reporting it - mostly because it was so hard to describe or narrow down. It affected even older Drupal 8 sites using Layout Builder. Wasn't until we isolated it to the off-canvas.reset.css was I able to find this issue.

Thankyou @justcaldwell for documenting it so well.

I've downgraded my Chrome to version 87 for now.

pbone3b’s picture

I can confirm getting this same issue from:
docroot/core/themes/stable/css/core/dialog/off-canvas.reset.css

justcaldwell’s picture

Hi, @blainelang and pbone3b. I'm glad this issue is increasing the visibility. It's closed as a dup of #2958588: Off-canvas style resets are overriding styles (especially SVGs) resulting in display issues, which has a patch (as well as some other alternatives) for resolving the issue until a permanent solution lands. Cheers!

blainelang’s picture

Thanks @justcaldwell for pointing that out!

blainelang’s picture

Just updated from 9.1.5 to 9.1.7 and the patch that used to work from issue https://www.drupal.org/project/drupal/issues/2958588 does not apply anymore. Issue #2958588 has been closed as 'FIXED' 3 days ago.

Any work around?