Dialog close icon with Layout Builder in Drupal 10

Created on 5 July 2023, over 1 year ago
Updated 17 September 2023, over 1 year ago

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

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States karlshea Minneapolis πŸ‡ΊπŸ‡Έ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @karlshea
  • πŸ‡ΊπŸ‡ΈUnited States karlshea Minneapolis πŸ‡ΊπŸ‡Έ
  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

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

  • πŸ‡ΊπŸ‡ΈUnited States karlshea Minneapolis πŸ‡ΊπŸ‡Έ

    @saschaeggi I'm not

  • πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

    +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.

  • πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

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

  • πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

    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.

  • πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

    @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.

  • πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

    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.

  • Status changed to Fixed over 1 year ago
  • πŸ‡¨πŸ‡­Switzerland saschaeggi Zurich

    Fixed on dev branch πŸ‘

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

Production build 0.71.5 2024