When using Drupal modal dialog system there is an error that are log to the console of the browser :
Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'option'
This problem is not blocking, is just annoying.
Steps to reproduce
- Go to a page containing a modal dialog like /admin/structure/block
- Click on the link opening the modal (on /admin/structure/block page click on the "Place block" button)
- Close the modal
- Resize the page
Technical steps
- Resizing the window call the Drupal.displace function (misc/displace.js line 56)
- displace trigger a drupalViewportOffsetChange event (line 81)
- This event trigger the resetSize function for dialog (misc/dialog/dialog.position.js line 34)
- Which try to call the dialog method (but dialog has been closed)
Proposed solution
See patch