Component/slot overlay borders can be misaligned when nested

Created on 16 July 2025, 3 days ago

Overview

When two JS Code Components are nested one inside the other the bounding client rect calculations that create the ComponentOverlay and SlotOverlay can get confused resulting in the overlay for the inner component to be mis-aligned.

Proposed resolution

The calculateBoundingRect function in function-utils.js attempts to take into account elements that have display: contents; by finding the direct children and using the size of those. This doesn't account for nested components correctly where it's possible to end up with an <astro-island> (that wraps the inner component) as a direct child of a <astro-slot> (the parent component's slot). It fails in this scenario because the outer <astro-slot> has display: contents; and tries to use the child instead... but that also has display: contents; and so the rect returned has 0/0/0/0:height/width/top/left.

User interface changes

πŸ› Bug report
Status

Active

Version

0.0

Component

User interface

Created by

πŸ‡¬πŸ‡§United Kingdom jessebaker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024