Skip to content

JavaScript error in modal.js: cannot call methods on dialog prior to initialization #1136

@Toutouwai

Description

@Toutouwai

Short description of the issue

I've been seeing this JS error for a while but only recently found a reliable way to reproduce it using core functionality only. Besides the example given below the issue also affects modal editing of pages via ListerPro, and probably lots of other cases involving modal windows.

The error is...

Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'option'

...and the code responsible is: https://github.com/processwire/processwire/blob/51629cdd5f381d3881133baf83e1bd2d9306f867/wire/modules/Jquery/JqueryUI/modal.js#L218-L220

Steps to reproduce the issue

  1. Open a page in Page Edit that has two or more images in it.
  2. For one image, click the "Crop" button to open a modal window for the image.
  3. Close the modal.
  4. For a different image, click the "Crop" button to open a modal window for the image.
  5. With the modal still open, resize the browser window.
  6. Note the JS error in the console.

Screencast:
jserror

The JS error breaks all subsequent JS - e.g. in a ListerPro scenario the lister becomes non-functional.

Setup/Environment

  • ProcessWire version: 3.0.153

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions