Conversation
Use the overlay's own offset parent for position calculations instead of the table element's offset parent. The table fragment's offsetParent is its .superdoc-page container, but the resize overlay is rendered as a child of .super-editor whose offset parent is .super-editor-container. This coordinate space mismatch caused the overlay to be positioned at page-relative coordinates within the editor-container space, placing it off-screen for tables on any page after the first.
There was a problem hiding this comment.
Pull request overview
Fixes table column resize overlay positioning so resize handles appear correctly for tables on pages after the first, by aligning overlay coordinates with the overlay’s actual positioning context.
Changes:
- Add a DOM ref for the overlay element so positioning can be computed against the overlay’s own
offsetParent. - Update
updateOverlayRect()to compute overlayleft/toprelative tooverlayEl.offsetParentinstead oftableElement.offsetParent. - Adjust inline documentation/comments to reflect the new coordinate reference.
Comments suppressed due to low confidence (1)
packages/super-editor/src/components/TableResizeOverlay.vue:299
updateOverlayRect()now relies onoverlayEl.value?.offsetParent, but whenvisiblefirst flips true the overlay element hasn’t been rendered yet (due tov-if), sooverlayEl.valueis still null and the code falls back totableElement.offsetLeft/offsetTop. That fallback is page-relative (the original bug’s coordinate space) and can briefly place the overlay incorrectly on page 2+ (and potentially never correct ifvisibletoggles off quickly).
Consider deferring the initial updateOverlayRect() until after the overlay DOM is mounted (e.g., nextTick when visible becomes true / tableElement changes), and/or using a non-table-based reference element for the fallback (the overlay container / editor container) so the fallback can’t reintroduce page-relative positioning.
// Position overlay relative to its own offset parent (the element that
// position:absolute resolves against), NOT the table's offset parent.
// The table's offsetParent is its .superdoc-page, but the overlay is rendered
// as a child of .super-editor — a different coordinate space. Using the table's
// page as reference caused the overlay to be mispositioned on pages after the first.
const referenceEl = overlayEl.value?.offsetParent;
if (referenceEl) {
const referenceRect = referenceEl.getBoundingClientRect();
const left = tableRect.left - referenceRect.left + (referenceEl.scrollLeft || 0);
const top = tableRect.top - referenceRect.top + (referenceEl.scrollTop || 0);
overlayRect.value = {
left,
top,
width: tableRect.width,
height: tableRect.height,
};
} else {
// Fallback: use table's own offset position
overlayRect.value = {
left: props.tableElement.offsetLeft,
top: props.tableElement.offsetTop,
width: tableRect.width,
height: tableRect.height,
};
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in superdoc v1.11.0-next.21 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.12.0-next.1 The release is available on GitHub release |
Summary
Fixes table column resize handles not appearing on tables beyond the first page of a document.
Demo
CleanShot.2026-02-06.at.10.35.27.mp4
Root Cause
updateOverlayRect()inTableResizeOverlay.vuewas computing the overlay position relative to the table element'soffsetParent(the.superdoc-pagecontaining the table), but the overlay itself is rendered as a child ofdiv.super-editor— whoseposition: absoluteresolves against.super-editor-container, a completely different coordinate space.DOM hierarchy:
The old code did:
This produced page-relative coordinates (e.g.,
top: 150pxwithin page 2), but the overlay'sposition: absoluteresolved againstsuper-editor-container. On page 1, the numbers coincidentally aligned since page 1 starts near the top of the container. On page 2+, the overlay was placed near the top of the editor — completely off-screen from the actual table.Fix
Changed
updateOverlayRect()to compute coordinates relative to the overlay's ownoffsetParent(overlayEl.value.offsetParent) instead of the table's offset parent. This ensures the overlay is correctly positioned regardless of which page the table is on.Why This Doesn't Cause Side Effects
getBoundingClientRectsubtraction) is identicalisNearColumnBoundaryinSuperEditor.vue) is unaffected — it uses viewport-relativegetBoundingClientRectcoordinates which work correctly on all pagesevent.clientX - initialX) that are position-independentTest Plan