Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-715]): pin popover width via className so hidden-pass height is accurate

Adam Eivya6d0da52c8a6
diff --git a/client/src/components/ui/ProvenanceChip.jsx b/client/src/components/ui/ProvenanceChip.jsx
index 47794ec5c1..664bd860df 100644
--- a/client/src/components/ui/ProvenanceChip.jsx
+++ b/client/src/components/ui/ProvenanceChip.jsx
@@ -35,7 +35,11 @@ function popoverStyleFor(rect, align, popHeight) {
if (!h || belowTop + h <= vh - VIEWPORT_MARGIN) top = belowTop; // fits below
else if (aboveTop >= VIEWPORT_MARGIN) top = aboveTop; // flip above
else top = Math.max(VIEWPORT_MARGIN, vh - VIEWPORT_MARGIN - h); // clamp into view
- return { position: 'fixed', top, left, width, visibility: 'visible' };
+ // `width` drives only the `left` math above — the element's actual width is
+ // pinned by the w-64/max-w className so the hidden measure pass (which sets the
+ // height used for the flip) wraps text at exactly the visible width. Don't set
+ // width inline, or the two passes could measure at different widths.
+ return { position: 'fixed', top, left, visibility: 'visible' };
}
// Source-style provenance chip for health/longevity insights. Tap (or click) to
@@ -147,7 +151,7 @@ export default function ProvenanceChip({
// Rendered hidden for one layout-effect pass so its height is measurable
// before it's placed (the below/above flip needs that height).
style={popStyle}
- className="z-30 rounded-lg border border-port-border bg-port-card p-3 text-left shadow-xl"
+ className="z-30 w-64 max-w-[calc(100vw-1rem)] rounded-lg border border-port-border bg-port-card p-3 text-left shadow-xl"
>
<p className="mb-1 flex items-center gap-1.5 text-xs font-semibold text-gray-200 normal-case tracking-normal">
<Icon size={12} aria-hidden="true" className={`shrink-0 ${iconTone}`} />
diff --git a/client/src/components/ui/ProvenanceChip.test.jsx b/client/src/components/ui/ProvenanceChip.test.jsx
index bbaff9c4bb..91654ab30b 100644
--- a/client/src/components/ui/ProvenanceChip.test.jsx
+++ b/client/src/components/ui/ProvenanceChip.test.jsx
@@ -146,4 +146,14 @@ describe('ProvenanceChip', () => {
const popover = openPopover();
expect(popover.style.top).toBe('46px');
});
+
+ it('constrains width via className (not inline) so hidden and visible passes wrap identically', () => {
+ // The height that drives the below/above flip is measured during the hidden
+ // pass; if width were applied only to the visible style, the hidden pass would
+ // wrap at full width and under-measure. Pin width to the className instead.
+ stubChipRect({ left: 500, right: 560, top: 20, bottom: 40 });
+ const popover = openPopover();
+ expect(popover.className).toContain('w-64');
+ expect(popover.style.width).toBe(''); // width is NOT set inline
+ });
});