Problem/Motivation

I'm not sure if this is the right issue queue or not so maybe it needs to move to core, but since Gin is doing a lot of overrides I thought I'd try here first.

The close button on dialogs is invisible inside Layout Builder because the --jui-dialog-close-button-size (and also --jui-dialog-close-button-border-radius) CSS variable from Claro isn't making it into the frontend theme, so its width and height are zero.

This was not an issue in Drupal 9 because its version of Claro didn't use CSS vars for the close button height/width.

Steps to reproduce

Use Layout Builder to edit a node with Layout Builder iFrame Modal enabled, then add or edit a block which opens up a modal using Dialog.

Proposed resolution

Default the values in CSS? Or somehow get Claro's vars into the frontend theme?

Workaround

Add this to your frontend theme:

:root {
  // Claro vars don't make it to Layout Builder.
  --jui-dialog-close-button-size: 2em;
  --jui-dialog-close-button-border-radius: 50%;
}

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#5 Screenshot_20230913_111028.png71 KBidiaz.roncero

Comments

KarlShea created an issue. See original summary.

karlshea’s picture

Issue summary: View changes
saschaeggi’s picture

Status: Active » Postponed (maintainer needs more info)

@KarlShea are you using gin_lb? If so we might want to move it there.

karlshea’s picture

@saschaeggi I'm not

idiaz.roncero’s picture

StatusFileSize
new71 KB

+1 to this, not using gin_lb and seeing this problem after updating to Drupal 10 because of the missing variables.

Gin is used, but the source of the problem is Claro as Gin doesn't touch the width and height of the element.

Setting the variables --jui-dialog-close-button-size --jui-dialog-close-button-size solves the issue.

Screenshot of the CSS applied to the element.

The CSS applid to the element

idiaz.roncero’s picture

The surprising thing is that I can see /core/themes/claro/css/base/variables.css loaded on my theme ¿¿??

idiaz.roncero’s picture

SO.. i did a little investigation and the following is happening:

  1. When you load layout builder, you are using the front-end theme so no Claro assets are present on the page (claro/global-styling library, which includes the variables.css file)
  2. When you load the modal, the Gin theme kicks in and via AJAX the assets are loaded: now the variables.css file is present
  3. ...but, somehow (maybe because of dynamically loading CSS via AJAX?) the new CSS variables are not applied to the page: they all appear as undefined

If this is confirmed, it might be a major bug as CSS is moving towards variables and then, any AJAX loading of CSS assets that involves adding CSS variables might fail.

idiaz.roncero’s picture

@KarlShea are you using layout_builder_iframe_modal

If so, I think that's the culprit. The CSS is attached, but inside an iframe (while the dialog topbar, where the button is in, remains outside the iframe). That's why the CSS variables can't access the outer scope.

idiaz.roncero’s picture

My bad, this is independent of the use of layout_builder_iframe_modal.

It seems related to the fact that Layout Builder isn't using the admin, but the public theme, so Claro+Gin styling is not applied there.

  • saschaeggi committed b7530601 on 8.x-3.x
    Issue #3372697 by saschaeggi: Dialog close icon with Layout Builder in...
saschaeggi’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fixed on dev branch 👍

Status: Fixed » Closed (fixed)

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