@contentful/experiences-visual-editor-react 1.40.0-alpha-20250604T1545-078bcac.0 → 1.40.0-alpha-20250626T1127-cab6b9d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1433,6 +1433,10 @@ const findOutermostCoordinates = (first, second) => {
1433
1433
  left: Math.min(first.left, second.left),
1434
1434
  };
1435
1435
  };
1436
+ const isElementHidden = (rect) => {
1437
+ /** if the rect has no size and position, its element is not rendered in the DOM */
1438
+ return rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0;
1439
+ };
1436
1440
  const getElementCoordinates = (element) => {
1437
1441
  const rect = element.getBoundingClientRect();
1438
1442
  /**
@@ -4192,6 +4196,9 @@ const collectNodeCoordinates = (node, nodeToCoordinatesMap) => {
4192
4196
  const selectedElement = document.querySelector(`[data-cf-node-id="${node.data.id}"]`);
4193
4197
  if (selectedElement) {
4194
4198
  const rect = getElementCoordinates(selectedElement);
4199
+ if (isElementHidden(rect)) {
4200
+ return;
4201
+ }
4195
4202
  nodeToCoordinatesMap[node.data.id] = {
4196
4203
  coordinates: {
4197
4204
  x: rect.x + window.scrollX,