Just pulled the latest 11.x so I could checkout the top bar.

Drupal.displace() is not running on the sidebar anymore. I checked 11.1, and it it works great there.

Doing a bit of debugging, and it looks like the JS can't find the displace element to add the appropriate attribute to.

Issue fork drupal-3526180

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 changed the visibility of the branch 3526180-regression-drupal.displace-not to hidden.

mherchel changed the visibility of the branch 3526180-regression-drupal.displace-not to active.

mherchel’s picture

Status: Active » Needs review

Fix attached.

godotislate’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

The build job https://git.drupalcode.org/issue/drupal-3526180/-/jobs/5344144 failed, which is probably an intermittent failure and just needs a re-run.

Other than that, looks like there's an existing Nightwatch test for displace behavior in core/tests/Drupal/Nightwatch/Tests/jsDisplace.js and there are navigation Nightwatch tests in core/modules/navigation/tests/src/Nightwatch/Tests/. I think there probably should be a Nightwatch test for displace + navigation? Not completely familiar with how those tests work.

mherchel’s picture

Status: Needs work » Needs review

Yeah the current tests passed when I re-ran them.

Just pushed a simple nightwatch test. Lets see if this passes (I didn't test it locally 😬🤞)

mherchel’s picture

Yay! Test is passing. Note that I don't test out displace's functionality (that gets tested in its respective tests), I just test that the attribute is added properly, which is what the JS in this module does.

godotislate’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Looks like the regression might have come from #3504722: Navigation Expand/Collapse logic is not working properly in conjunction with Big Pipe.

Since initDisplace() is moved outside a behavior, with Big Pipe enabled, it's possible that initDisplace() is called before the .admin-toolbar element is in the DOM and hence data-offset-${edge} does not get added.

Moving the call to initDisplace() inside a behavior means that at some point the context passed to the behavior will contain .admin-toolbar, so the offset attribute gets added to the element.

Nightwatch test confirms that the data-offset-left attribute gets added correctly, and I think it's safe to assume in the test that the direction is 'left'.

lgtm.

godotislate’s picture

Version: 11.2.x-dev » 11.x-dev
godotislate’s picture

Missed that the MR should be against 11.x. Right now it's against 11.2.x.

mherchel’s picture

Fixing now

mherchel’s picture

OK. Should be good!

nod_’s picture

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

Committed and pushed 5aa1596bdc3 to 11.x and 19df4f1774c to 11.2.x. Thanks!

  • nod_ committed 19df4f17 on 11.2.x
    Issue #3526180 by mherchel, godotislate: Regression: Drupal.displace()...

  • nod_ committed 5aa1596b on 11.x
    Issue #3526180 by mherchel, godotislate: Regression: Drupal.displace()...
nod_’s picture

Status: Fixed » Closed (fixed)

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