Stable theme's off-canvas reset css causes incorrect box-sizing

Created on 10 February 2023, over 1 year ago
Updated 14 June 2024, 3 months ago

Problem/Motivation

In the postcss file core/themes/stable/css/core/dialog/off-canvas.reset.pcss.css, properties for HTML elements rendered in the off-canvas dialog are reset using all: initial;. This is then followed by box-sizing: border-box. But in the generated css, all: initial; is not followed by box-sizing: border-box and this means box-sizing is the CSS standard default "content-box". If your theme is based off the stable theme, you may find that elements rendered within the off-canvas dialog do not have correct dimensions. For us, we have custom themes based on the stable theme and we are seeing incorrectly sized buttons output by the Moderation Sidebar contrib module.

Steps to reproduce

Compare the postcss with the generated css.

In core/themes/stable/css/core/dialog/off-canvas.reset.pcss.css we have this:

#drupal-off-canvas {
  & span,
  & applet,
  ...
  ...
  ...
  & input,
  & select,
  & textarea {
    all: initial;
    box-sizing: border-box;
    text-shadow: none;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: initial;

    &:after,
    &:before {
      all: initial;
      box-sizing: border-box;
      text-shadow: none;
      -webkit-font-smoothing: antialiased;
      -webkit-tap-highlight-color: initial;
    }
  }
}

If we now look at the generated css in core/themes/stable/css/core/dialog/off-canvas.reset.css we have this:

#drupal-off-canvas span,
#drupal-off-canvas applet,
... 
...
...
#drupal-off-canvas input,
#drupal-off-canvas select,
#drupal-off-canvas textarea {
  ...
  ...
  ...
  box-sizing: content-box;
  box-sizing: border-box;
  ...
  ...
  ...
  all: initial;
  ...
}

The all: initial; line is not followed by box-sizing: border-box as it is in the postcss file. So box-sizing is effectively set to be content-box by the last all: initial; line.

Proposed resolution

Fix PostCSS processing somehow so that the box-sizing: border-box line that should follow all: initial; is preserved.

🐛 Bug report
Status

Closed: outdated

Version

11.0 🔥

Component

Stable theme

Created by

🇬🇧United Kingdom Glugmeister

Live updates comments and jobs are added and updated live.
  • Needs frontend framework manager review

    Used to alert the fron-tend framework manager core committer(s) that a front-end focused issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024