The Drupal.displace() method adds CSS custom properties to root HTML element (see https://www.drupal.org/node/3275981).

When an off-canvas top dialog is created, it outputs the correct value for the custom CSS property --drupal-displace-offset-top, however it outputs an invalid value for the --drupal-displace-offset-right property (which should be zero or not set).

Note this can be tested by installing the "Dialog test" module in the D10 compatible fork of cd_tools from @bnjmn (https://github.com/bbenjamin/cd_tools)

Issue fork drupal-3363127

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

mherchel created an issue. See original summary.

mherchel’s picture

Issue tags: -JavaScript +JavaScript

I wonder if this is more a bug with either cd_tools or something with the off-canvas. I'm seeing the data-offset-right attribute on the top dialog which is causing this.

gábor hojtsy’s picture

Raising to major, as this also makes the now stable Workspaces impossible to demonstrate with Umami as I just reproduced when trying to screenshot it. When I undid the bogus --drupal-displace-offset-right value, it looked fine with Umami.

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

nod_’s picture

Status: Active » Needs review

I never like the auto compute of offset, the issue is that an empty data-offset-right/left is added when the offcanvas is created. Whether it's on the side or on top of the page. Making sure only the relevant attribute is added based on the position solves the issue.

gábor hojtsy’s picture

I tried this with both Umami and Workspaces and Umami and Settings tray and they both worked fine. The code looks like the correct solution but I am not an expert in this. Attached videos of how it works after the fix.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Did a more extensive code context review and this looks like indeed the right place and way to fix this.

  • nod_ committed 6caa8062 on 10.3.x
    Issue #3363127 by nod_, Gábor Hojtsy, mherchel: Drupal Displace outputs...

  • nod_ committed 14e9234d on 10.4.x
    Issue #3363127 by nod_, Gábor Hojtsy, mherchel: Drupal Displace outputs...

  • nod_ committed 9006cbed on 11.0.x
    Issue #3363127 by nod_, Gábor Hojtsy, mherchel: Drupal Displace outputs...
nod_’s picture

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

Committed and pushed 3401675c3f to 11.x and 9006cbedab to 11.0.x and 14e9234d42 to 10.4.x and 6caa8062d0 to 10.3.x. Thanks!

  • nod_ committed 3401675c on 11.x
    Issue #3363127 by nod_, Gábor Hojtsy, mherchel: Drupal Displace outputs...

Status: Fixed » Closed (fixed)

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