From 94182057d89cc4edfa5b1b4a8a34ebf4fbde050d Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Thu, 6 Nov 2025 15:02:25 -0500 Subject: [PATCH] pad quotehandler positioning to avoid edge collision --- app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx b/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx index 8a689de6..742602c8 100644 --- a/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx +++ b/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx @@ -83,6 +83,14 @@ export function QuoteHandler() { selectionTop += quoteRect.height + 8; } + // Ensure tooltip stays within viewport bounds (330px wide + 8px padding) + const TOOLTIP_WIDTH = 338; + const viewportWidth = window.innerWidth; + const maxLeft = viewportWidth - TOOLTIP_WIDTH; + + // Clamp selectionLeft to stay within bounds + selectionLeft = Math.max(8, Math.min(selectionLeft, maxLeft)); + let startIndex = findDataIndex(range.startContainer); let endIndex = findDataIndex(range.endContainer); if (!startIndex || !endIndex) return; -- 2.51.2