Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion bundles/AdminBundle/Resources/public/js/pimcore/overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,18 @@ Ext.override(Ext.picker.Date, {
}
});

function isElementInTheViewport(domElement) {
if (domElement && typeof domElement.getBoundingClientRect === "function") {
const rect = domElement.getBoundingClientRect();
if (rect) {
return (
rect["top"] < window.innerHeight &&
rect["bottom"] > 0
);
}
}
return false;
}

/** workaround for [DataObject] Advanced Image Dropzone only works once #9115
* Issue: on node drop the component gets destroyed. On mouse up it then tries to focus an already destroyed element.
Expand All @@ -950,7 +962,9 @@ Ext.override(Ext.dom.Element, {
} else {
Ext.fireEvent('beforefocus', dom);
if (dom) {
dom.focus();
dom.focus({
preventScroll: isElementInTheViewport(dom)
});
}
}

Expand Down