Skip to content
Snippets Groups Projects

Issue #3409505: Uncaught TypeError: Cannot read properties of null (reading 'style') (toolbar.js)

Closed Issue #3409505: Uncaught TypeError: Cannot read properties of null (reading 'style') (toolbar.js)
1 file
+ 17
13
Compare changes
  • Side-by-side
  • Inline
@@ -208,26 +208,30 @@
$(window).on({
'dialog:aftercreate': (event, dialog, $element, settings) => {
const toolbarBar = document.getElementById('toolbar-bar');
toolbarBar.style.marginTop = '0';
if (toolbarBar) {
toolbarBar.style.marginTop = '0';
// When off-canvas is positioned in top, toolbar has to be moved down.
if (settings.drupalOffCanvasPosition === 'top') {
const height = Drupal.offCanvas
.getContainer($element)
.outerHeight();
toolbarBar.style.marginTop = `${height}px`;
$element.on('dialogContentResize.off-canvas', () => {
const newHeight = Drupal.offCanvas
// When off-canvas is positioned in top, toolbar has to be moved down.
if (settings.drupalOffCanvasPosition === 'top') {
const height = Drupal.offCanvas
.getContainer($element)
.outerHeight();
toolbarBar.style.marginTop = `${newHeight}px`;
});
toolbarBar.style.marginTop = `${height}px`;
$element.on('dialogContentResize.off-canvas', () => {
const newHeight = Drupal.offCanvas
.getContainer($element)
.outerHeight();
toolbarBar.style.marginTop = `${newHeight}px`;
});
}
}
},
'dialog:beforeclose': () => {
const toolbarBar = document.getElementById('toolbar-bar');
toolbarBar.style.marginTop = '0';
if (toolbarBar) {
toolbarBar.style.marginTop = '0';
}
},
});
});
Loading