Problem/Motivation

When adding/editing a block in layout builder, if you resize the browser then the off-canvas sidebar doesn't re-position itself correctly.

Steps to reproduce

  1. use Drupal 10.0.9, or 9.5.9
  2. enable layout builder and turn it on for a content type
  3. create a page using the layout builder content type
  4. edit the layout for the page
  5. click "Add section"
  6. resize the right side of browser

Expected behaviour

The layout builder sidebar should move with the right side of the browser.

Actual behaviour

Sidebar stays in one place, or jumps around.

screenshot

I think it has something to do with this change: https://git.drupalcode.org/project/drupal/-/commit/e2d11b5fff7ba50dbb18f...

Issue fork drupal-3359465

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

bwaindwain created an issue. See original summary.

bwaindwain’s picture

Issue summary: View changes
bwaindwain’s picture

Version: 9.5.x-dev » 10.0.x-dev
Issue summary: View changes
StatusFileSize
new237.16 KB

added a gif for fun

bwaindwain’s picture

Issue summary: View changes
bwaindwain’s picture

Issue summary: View changes
StatusFileSize
new211.44 KB
bwaindwain’s picture

Issue tags: +Layout Builder, +off-canvas
gauravvvv’s picture

Status: Active » Needs review
StatusFileSize
new712 bytes

I have attached patch for same. please review

Status: Needs review » Needs work

The last submitted patch, 8: 3359465-8.patch, failed testing. View results

bwaindwain’s picture

Tested patch #8 in Drupal 10.1.0 and it works great. Thanks @Gauravvvv

I don't know why the tests failed

guido_s’s picture

Couldn't apply the patch on Drupal 10.1.6.
But it would be good to have this working.
The issue doesn't only appear when resizing the browser, but also when resizing the off-canvas itself.

pyrello’s picture

@bwaindwain I think the whole reason the original change was made was because of random test failures, so I think it makes sense that the test fails again with the patch reverting that change: https://www.drupal.org/project/drupal/issues/3350972.

Looking through that original issue, it seems like either state causes problems. In all likelihood this means that the JS needs to be revamped to fix this in a way that won't cause periodic failures (like in the test) or the behavior described in this issue.

pyrello’s picture

I opened a separate issue to address the broader issues here in a way that won't just reintroduce a random test failures: https://www.drupal.org/project/drupal/issues/3411496

Version: 10.0.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

_shy’s picture

StatusFileSize
new710 bytes
new376 bytes

Gauravvvv, thanks for the patch, it works well with Drupal 10.2.1.
I did some testing and found that if add some more timeout, then resize looks slightly.

Updated patch, increased timeout.

_shy’s picture

StatusFileSize
new1.12 KB
new1.39 KB

Updated the last patch to make it smoother during resizing and fixed width changes during resizing.

bnjmnm’s picture

StatusFileSize
new409.5 KB

When resizing quickly, the solution in #16 results in an unwanted width increase of the off canvas dialog.

#15 seems to work but it does so at the expense of removing debounce functionality which had been working fine until the fix-the-tests changes in #3350972: [random test failure] Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::testReloadWithNoSections(). It is probably worth exploring options that maintain debounce and allow tests to work. It's possible the ideal solution is with changes that only impact test runs in a test-only module, allowing the debounce calls to be switched back to the way they were when they worked reliably.

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

utkarsh_33’s picture

I reverted the change made in #3350972: [random test failure] Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderUiTest::testReloadWithNoSections() so that we are back to the original use of debounce functionality as discussed in #17 and the test are also passing.

bnjmnm’s picture

By just reverting the change, it will likely reintroduce the intermittent failure. You can determine if this is happening by customizing drupalci.yml to run the test multiple times while skipping other tests, such as how it was done in issue #3350972. See this patch for how the test in question was run repeatedly to check for the intermittent failure.

  • If the test is no longer intermittently failing, it's probably worth checking with contributors that worked on #3350972 and see if they are confident that this reversion is fine
  • If the test is still intermittently failing, then the fix from #3350972 or something equivalent should be added in a test-only module so it addresses the intermittent failures without impacting real-user UI interaction.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.