- Issue created by @Grevil
- 🇩🇪Germany Grevil
We could add:
if (!(window instanceof Element)) { return; }
But window will never be an element, meaning this whole js seems kind of useless?
- 🇩🇪Germany Grevil
(function ($, Drupal) { Drupal.behaviors.drowl_admin_core_dialog_enhancements = { attach: function (context, settings) { // Add body classes if a modal is currently opened or not. // We use them in drowl_admin.theme_overrides.gin.scss to block // disturbing body scrolling while a modal is opened. if ($(".webform-ajax-form-wrapper").length == 0) { // Exclude webform from this, they do weird things we wont support here. $(once("drowl-admin-core-dialog-enhancements", window)) // THIS ALWAYS FAILS .on("dialog:beforecreate", function () { $("body:first").addClass("drowl-admin--core-dialog-open"); })
(The code in question "drowl_admin.core_dialog_enhancements.js")
- First commit to issue fork.
- 🇩🇪Germany Anybody Porta Westfalica
The once functions take 2 parameters, a string id without spaces and an array-like object. The recommended way to use it is to call it with the string you would use in a querySelectorAll() call. You can only use once with objects that are instances of Element, which means you can not use it with the document or window object. If you need a page-level element please use 'html' or 'body' as the selector used in the once call: once('my-global-once', 'html').
- @anybody opened merge request.
- 🇩🇪Germany Anybody Porta Westfalica
@thomas.frobieter please test if this works.
It seems that GIN (or the core dialog.js) already prevents scrolling when the dialogue is open. Therefore, this fix is no longer required.
I will remove the Javascript file and the corresponding CSS code.
-
thomas.frobieter →
committed e59040ba on 3.x authored by
anybody →
Issue #3543819 by anybody, grevil: Fix javascript error "window" is not...
-
thomas.frobieter →
committed e59040ba on 3.x authored by
anybody →