For example, in a custom layout situation where the region content appears in a structure like this:

<div {{ region_attributes.first }}>
  <div>
    {{ content.first }}
  </div>
</div>

The Drag-and-drop reordering doesn't work because the selector takes .js-layout-builder-region > .js-layout-builder-block instead of .js-layout-builder-region .js-layout-builder-block.

CommentFileSizeAuthor
#44 3062742-44.patch1.1 KBweseze
#41 reroll_diff_40-41.txt1.88 KBzeeshan_khan
#41 3062742-28.patch2.63 KBzeeshan_khan
#40 3062742-27.patch3.12 KBjustskew
#36 3062742-26.patch1.5 KBbernardm28
#33 regions_drag_3062742.mov13 MBHeikkiY
#26 interdiff_23-25.txt2.25 KBdanflanagan8
#25 interdiff_23-25.txt9.02 KBdanflanagan8
#25 3062742-25.patch8.03 KBdanflanagan8
#23 3062742-23-FAIL.patch5.78 KBdanflanagan8
#22 3062742-22-FAIL.patch5.78 KBdanflanagan8
#20 3062742-20.patch5.33 KBranjith_kumar_k_u
#19 3173832-18_19.txt512 bytesGauravvvv
#19 3173832-19.patch4.47 KBGauravvvv
#18 interdiff_10_0-18.txt2.45 KBnaveen433
#18 3062742-18.patch4.97 KBnaveen433
#10 3062742_10.patch2.24 KBdejanp
#4 3062742_4.patch2.21 KBdejanp
#2 3062742_2.patch1.13 KBdejanp

Issue fork drupal-3062742

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pinkdexo created an issue. See original summary.

dejanp’s picture

Status: Active » Needs review
FileSize
1.13 KB

I think this shouldn't break anything.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

dejanp’s picture

Because of the deprecation of the jQuery UI library, this patch applies to Drupal 8.8.x and above.

tim.plunkett’s picture

Issue tags: +Blocks-Layouts, +Needs tests

Is this something that could be tested with a functional JS test?

tim.plunkett’s picture

Status: Needs review » Needs work
andrimont’s picture

This is great, thank you @pinkdexo
It helps me to save the use of the layout of the TheMag theme -a great work-.
In my case Drupal 8.8.4 I used the #4 patch.
Success to get back the useful drag and drop !

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

dejanp’s picture

This is an updated patch that works with D9. It could be tested with functional JS but not sure how to do that because it requires a specific template structure - shown in comment #1.

djsagar’s picture

As Patch is created for above issue i changed the status need work to need review.

djsagar’s picture

Status: Needs work » Needs review
TylerMarshall’s picture

This patch (tested the 8.9.x) works flawlessly for me.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

BenStallings’s picture

Status: Needs review » Reviewed & tested by the community

Patch #10 works for me, too.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs work

Glad it's working! Now just for the automated test coverage...

naveen433’s picture

Assigned: Unassigned » naveen433

I am working on this

naveen433’s picture

check the drupal standards

Gauravvvv’s picture

Re-rolled patch #18, Attached interdiff for same.

ranjith_kumar_k_u’s picture

Fixed custom command failure

Status: Needs review » Needs work

The last submitted patch, 20: 3062742-20.patch, failed testing. View results

danflanagan8’s picture

Status: Needs work » Needs review
FileSize
5.78 KB

I tried writing tests for this and boy was it hard! I have a partial test in this patch. I don't know how to make it any better.

The problems I had were:

1. SortableTestTrait::sortableTo() only simulates a drag and does actually have the browser perform drag and drop.
2. For some reason I don't understand, NodeElement::dragTo() wasn't working for LB blocks, even with the default templates.

This is just a new fail test, so no interdiff.

danflanagan8’s picture

FileSize
5.78 KB

Sorry...Here's another.

Status: Needs review » Needs work

The last submitted patch, 23: 3062742-23-FAIL.patch, failed testing. View results

danflanagan8’s picture

Status: Needs work » Needs review
FileSize
8.03 KB
9.02 KB

That failed exactly as expected. Clicking the body block did not trigger any sort of "sortable" behavior. Here's the fail patch with the fix from #10 added.

NOTE: Ignore that interdiff. The correct one is attached to #26.

danflanagan8’s picture

FileSize
2.25 KB

Ignore that interdiff. Oof.

Here's the real interdiff, which is simply the fix from #10.

danflanagan8’s picture

Aha! Here's why my attempts to use NodeElement::dragTo() weren't working. Per the SortableTestTrait:

* Selenium uses ChromeDriver for FunctionalJavascript tests, but it does not
* currently support HTML5 drag and drop. These methods manipulate the DOM.
* This trait should be deprecated when the Chromium bug is fixed.

This is tracked in an issue: #3078152: Follow-up to #3064049 Deprecate sortable Trait.

I'm pretty sure we can't make a good test for this issue until Chromium supports html5 drag and drop. I say that because the following test runs flawlessly on 9.3.x.

/**
   * Tests the Layout Builder UI with extra wrapper divs in template.
   */
  public function testLayoutBuilderCustomTemplate() {
    // Override the layout templates.
    \Drupal::service('module_installer')->install(['layout_builder_custom_template_test']);
    \Drupal::service('plugin.manager.core.layout')->clearCachedDefinitions();
    \Drupal::service('theme_handler')->refreshInfo();
    $this->testLayoutBuilderUi();
  }

That is, big existing test does not fail with the custom templates featuring extra wrapping divs.

I think the wisest move would be to postpone this issue until the Chromedriver bug is fixed. To me it looks like there's no existing robust test coverage of LB drag-and-drop, which makes changes really risky!

That said, anyone running into this bug will probably be ok with the patch in #10.

The fail patch from #23 will be easy to update when we can do real dragging, so that's a good start.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

TylerMarshall’s picture

Status: Needs review » Reviewed & tested by the community

Thank you thank you thank you!

Patch 25 works for me just fine! I can RTBC!

danflanagan8’s picture

Status: Reviewed & tested by the community » Needs work

This still needs tests, so back to NW.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

HeikkiY’s picture

FileSize
13 MB

We are seeing this same bug with Drupal core 9.4.8 and following contrib modules:
- Field group 8.x-3.3
- UI Patterns 8.x-1.3.

We have a content display mode with multiple regions

Regions are something like:
- Header
- Main content
- Footer

When I create a field group inside the region, the drag breaks completely.

There is also a related issue in Field group: https://www.drupal.org/project/field_group/issues/3085858.

I have tried the patches from issues 3089151, 3087608 and this one. It seems it gets a little bit better and with trial and error I can get the field to stay in a correct region. But sometimes it just resets. Here is a attached video recording of what happens when I drag multiple times and then save.

Without the patches, the dragging is completely broken and you cannot even stop the drag. The field you are dragging just keeps following you. With the patch from issue 3087608 the dragging works a bit better but it let's me let go of dragging. But after saving the form, the region is still reset.

Without the patches the functionality seemed to be that if I try to drag the field to a region, it gets assigned to the first available region instead of the one I would like to drag the field to. I have tested this with Claro, Gin and Seven admin themes.

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

bernardm28’s picture

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

ctrlADel’s picture

Looked like the reroll was missing the tests that were in the patch from #25 so pushed those to both the 9.5 and 10 MRs

justskew’s picture

zeeshan_khan’s picture

Patch rerolled for 9.5.x
Added reroll diff.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs issue summary update

Was previously tagged for tests which still need to happen.

Also issue summary could use some updating.

Thanks.

Version: 10.1.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, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

weseze’s picture

Rerolled for D10.1.x

xeiro’s picture

I can confirm #44 patch applies to D10.1.8

zeeshan_khan’s picture

@weseze - Please provide interdiff
Also we need a re-roll for 11.x