Skip to content

Commit 1fd10fc

Browse files
committed
fix(tour): scrim only paints when highlight target is actually measured
1 parent 4ddb648 commit 1fd10fc

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

src/dashboard/src/components/tour/GuidedTour.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -386,26 +386,28 @@ export function GuidedTour({ activeTab, chatEnabled = true, onTabChange, onClose
386386

387387
return (
388388
<>
389-
{/* Dim overlay with cutout around highlighted element. Mounts
390-
* only while the tour is active (App.tsx gates this whole
391-
* component on `tourActive`). */}
392-
<div data-tour-overlay className={styles.svgOverlay}>
393-
<svg width="100%" height="100%" className={styles.svgFill}>
394-
<defs>
395-
<mask id="tour-mask">
396-
<rect width="100%" height="100%" fill="white" />
397-
{rect && (
389+
{/* Dim overlay with cutout around highlighted element. Painted
390+
* only when a `rect` is measured — without that gate the scrim
391+
* renders solid dim with no hole (no target found / wrong tab),
392+
* which is what the user saw as "full-page dim with no tour info"
393+
* after navigating to a tab the current step doesn't target. */}
394+
{rect && (
395+
<div data-tour-overlay className={styles.svgOverlay}>
396+
<svg width="100%" height="100%" className={styles.svgFill}>
397+
<defs>
398+
<mask id="tour-mask">
399+
<rect width="100%" height="100%" fill="white" />
398400
<rect
399401
x={rect.left - pad} y={rect.top - pad}
400402
width={rect.width + pad * 2} height={rect.height + pad * 2}
401403
rx="10" fill="black"
402404
/>
403-
)}
404-
</mask>
405-
</defs>
406-
<rect width="100%" height="100%" fill="rgba(0,0,0,0.55)" mask="url(#tour-mask)" />
407-
</svg>
408-
</div>
405+
</mask>
406+
</defs>
407+
<rect width="100%" height="100%" fill="rgba(0,0,0,0.55)" mask="url(#tour-mask)" />
408+
</svg>
409+
</div>
410+
)}
409411

410412
{/* Click-away layer */}
411413
<div data-tour-overlay className={styles.clickAway} onClick={handleClose} />

0 commit comments

Comments
 (0)