Skip to content
Snippets Groups Projects

Fix drag n drop issue Cannot read properties of undefined (reading 'querySelector')

+ 6
4
@@ -143,11 +143,13 @@
lpbBuilderComponent.forEach((el) => {
const components = Array.from(el.children).filter(n => n.classList.contains('js-lpb-component'));
// Set the tabindex of the first component's up arrow to -1.
components[0].querySelector('.lpb-up')?.setAttribute('tabindex', '-1');
if (components.length > 0) {
// Set the tabindex of the first component's up arrow to -1.
components[0].querySelector('.lpb-up')?.setAttribute('tabindex', '-1');
// Set the tabindex of the last component's down arrow to -1.
components[components.length - 1].querySelector('.lpb-down')?.setAttribute('tabindex', '-1');
// Set the tabindex of the last component's down arrow to -1.
components[components.length - 1].querySelector('.lpb-down')?.setAttribute('tabindex', '-1');
}
});
}
Loading