Problem/Motivation

If you have a jQuery UI dialog modal (a dialog having the modal configuration set to TRUE) and a Off canvas rendered at the same time (i.e. the dialog is opened via the Off canvas), the modal is repositioned incorrectly when resizing the window.

Here is an example using Layout Builder and the contrib. module Layout Builder Modal:

(thanks to kevinfunk for providing the GIF in #3074302)

The expected behaviour here would be that the modal keeps being centered on window resize.

You can also reproduce this behaviour in Drupal core:

            <a href="/node/add/page" class="use-ajax" data-dialog-options='{"width": 500,"modal": true,"autoResize":true}' data-dialog-type="dialog">Dialog</a>

            <a href="/node" class="use-ajax" data-dialog-renderer="off_canvas" data-dialog-type="dialog">Off canvas</a>

If you only would open the Dialog, it would resize and the position would be as expected. But if you first open the off canvas, and then the dialog the same behaviour as with Layout Builder Modal.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

johndevman created an issue. See original summary.

johnwebdev’s picture

johnwebdev’s picture

Issue summary: View changes
johnwebdev’s picture

Status: Active » Needs review
StatusFileSize
new5.66 KB

Here is a failing test. I'm thinking we should probably change the assertion just to ensure it's not repositioned on the top right corner on a resize instead of doing some guessing with where it's approximately is supposed to be using the left property. Nonetheless it's the start, and it shows the bug.

Status: Needs review » Needs work

The last submitted patch, 4: 3075236-4-FAIL.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

johnwebdev’s picture

Trying to debug and from what I can see is that Drupal.offCanvas.resetSize targets the dialog opened after the off canvas instead of the off canvas div. I'm not sure why that happens though.

It looks like the event listener stored does point to the correct element. For fun, I decided to remove the debounce() around the resize, and that seemed to resolve the issue.

johnwebdev’s picture

Status: Needs work » Needs review
StatusFileSize
new7.39 KB

Let's see if test passes when removing the debounce() function.

Status: Needs review » Needs work

The last submitted patch, 7: 3075236-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

johnwebdev’s picture

Status: Needs work » Needs review
StatusFileSize
new7.75 KB
new2.19 KB

Reworked the test a bit.

johnwebdev’s picture

StatusFileSize
new7.63 KB
new513 bytes

@group should still be dialog though :)

johnwebdev’s picture

Status: Needs review » Needs work

Although this passes I believe we should look in to why this happens, and see if we can fix that. Removing the debounce would affect the performance.

johnwebdev’s picture

Status: Needs work » Needs review
StatusFileSize
new7.19 KB
new1.81 KB

Okay, this brings back the debounce.

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

Drupal 8.7.9 was released on November 6 and is the final full bugfix release for the Drupal 8.7.x series. Drupal 8.7.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.8.0 on December 4, 2019. (Drupal 8.8.0-beta1 is available for testing.)

Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.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: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should 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.

seanb’s picture

Version: 8.9.x-dev » 9.0.x-dev
StatusFileSize
new7.52 KB

Reroll for Drupal 9.

raman.b’s picture

Version: 9.0.x-dev » 9.2.x-dev
StatusFileSize
new5.85 KB
new7.29 KB
new7.28 KB
new3.49 KB
new587 bytes

Re-rolling for 9.2.x

We also need to account for the 1px border added by .ui-widget.ui-widget-content

The last submitted patch, 16: 3075236-16-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

design.er’s picture

Patch #16 is working great for me on multiple projects with 9.1.5.
Thanks for taking care of that! :)

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.

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.

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.

ranjith_kumar_k_u’s picture

StatusFileSize
new7.54 KB
new762 bytes

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.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new144 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

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.

ricovandevin’s picture

StatusFileSize
new7.57 KB

Reroll

vlad.dancer’s picture

Status: Needs work » Needs review
vlad.dancer’s picture

Patch from #27 applies for 9.5.10. Thank you @ricovandevin.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new85 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

seanb’s picture

Status: Needs work » Needs review
StatusFileSize
new7.59 KB

Patch in #27 failed to apply. Here is another attempt for a reroll of #22 for 9.5.10.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new92 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new7.59 KB

I have re-rolled patch #31, for D11. Not adding interdiff as the patch doesn't applies anymore to d11.

gauravvvv’s picture

StatusFileSize
new7.65 KB
new694 bytes

Added patch for 9.5 along with interdiff with #31.

gauravvvv’s picture

StatusFileSize
new6.51 KB

Wrong patch uploaded in #33, added the correct patch for d11.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new3.11 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new6.49 KB
new642 bytes

Fixing custom command failure issues in #35, please review it.

Thanks & Regards,
Mrinalini

smustgrave’s picture

Status: Needs review » Needs work

CC failure

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new6.52 KB
new652 bytes

Tried fixing CC failures, attached interdiff for same

Status: Needs review » Needs work

The last submitted patch, 39: 3075236-39.patch, failed testing. View results

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.