Use Drupal.dialog call instead of jQuery dialog

Created on 6 February 2023, over 1 year ago
Updated 22 May 2024, about 1 month ago

In the project I am working on currently there is a lot of use of modal dialogs and they are custom themed. The theming code relies on catching the dialog:aftercreate event raised by the Drupal dialog API.

Because Automated Logout uses the jQuery dialog API directly, this event is not raised and as a result the logout modal does not go through the custom theme code, hence its display and behaviour characteristics are incorrect. (Worse, because of how the theme is set up it is actually invisible, but that's not relevant for this issue.)

The Drupal dialog API is being loaded anyway by the module's libraries.yml, so I think it makes sense to use it to get the benefit of the extra events it makes available.

Patch to follow.

Feature request
Status

RTBC

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom alfaguru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @alfaguru
  • Status changed to RTBC over 1 year ago
  • 🇬🇧United Kingdom lukus

    Tested and this is now working well.

  • Status changed to Needs work about 1 year ago
  • 🇬🇧United Kingdom kiwimind

    Have tested the patch and it appears to solve one of the issues that I raised on https://www.drupal.org/project/autologout/issues/3361785 🐛 Inconsistent modal behaviour Needs review , so I'm happy that the code does what it's supposed to.

    Prior to installing this patch, not only was it using jQuery, but it seemed to be inconsistent with the regularity of displaying the modal. Now it's showing every time.

    Going to need to sort out the failing tests though.

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 9 months ago
    15 pass, 7 fail
  • @deaom opened merge request.
  • Status changed to Needs review 9 months ago
  • 🇸🇮Slovenia DeaOm

    Added the patch to issue fork for easier maintaining. The tests are failing because of the core migration issue 🌱 [META] Serialization issues in Migration tests Active , but the code provided does seem to work, but setting the status to needs review, so somebody else can also again re-test and confirm it's working as expected.

  • First commit to issue fork.
  • Rebased the MR, tests are passing, testing by hand the modal also works fine.

    While the patch is the same as the issue fork, I'll hide the file since DrupalCI tests are deprecated, and without the tests fix they will never pass, if you need a patch you can use plain diff or generate a patch file using GitLab.

    Setting the issue to RTBC.

  • Status changed to RTBC 9 months ago
  • Status changed to Needs review 9 months ago
  • 🇸🇮Slovenia DeaOm

    Changed as much of JQuery to plain JS as I could, also removed the duplicated dialogs appearing when clicking on "Yes" button. There could be an issue of logging out after 10s after first "Yes" in D10, which is covered in 🐛 Drupal 10 second dialog logout Needs review . Needs manual testing to confirm everything is working as expected, the automated test are passing.

  • Status changed to RTBC 9 months ago
  • Local and gitlabCI tests are passing, testing by hand also works correctly. Just in case locally merged 🐛 Drupal 10 second dialog logout Needs review and that fixed the second dialog instantly closing. With this fix, there is no need for 🐛 Multiple dialogs open Postponed . I think this can be merged.

  • 🇺🇸United States jrglasgow Idaho

    The fork appears to have merge conflicts, please fix and I will merge them in.

Production build 0.69.0 2024