From 9893ade233fd33182c31e82a69690715fcab26f8 Mon Sep 17 00:00:00 2001 From: Hyko Date: Sat, 25 Apr 2026 18:35:11 -0400 Subject: [PATCH] fix(ui): move onMouseDown prevention to individual toolbar buttons and default linkNewTab to false - move `e.preventDefault()` from toolbar container to each individual button to avoid broad focus prevention - default `linkNewTab` state to `false` instead of `true` for new links - add `onMouseDown` prevention to color grid buttons --- .../components/BlockEditor/inline/Toolbar.client.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/shared/components/BlockEditor/inline/Toolbar.client.js b/src/shared/components/BlockEditor/inline/Toolbar.client.js index c85f61e..678cbb6 100644 --- a/src/shared/components/BlockEditor/inline/Toolbar.client.js +++ b/src/shared/components/BlockEditor/inline/Toolbar.client.js @@ -27,7 +27,7 @@ export default function InlineToolbar({ rect, activeMarks, onToggleMark, onPinCh const [pos, setPos] = useState({ top: 0, left: 0, flipped: false }); const [popover, setPopover] = useState(null); // 'color' | 'highlight' | 'link' | null const [linkUrl, setLinkUrl] = useState(''); - const [linkNewTab, setLinkNewTab] = useState(true); + const [linkNewTab, setLinkNewTab] = useState(false); useEffect(() => { onPinChange?.(popover !== null); @@ -91,7 +91,7 @@ export default function InlineToolbar({ rect, activeMarks, onToggleMark, onPinCh function openLinkPopover() { const link = activeMarks.find(m => m.type === 'link'); setLinkUrl(link?.href ?? ''); - setLinkNewTab(link ? !!link.newTab : true); + setLinkNewTab(link ? !!link.newTab : false); setPopover(p => (p === 'link' ? null : 'link')); } @@ -101,13 +101,13 @@ export default function InlineToolbar({ rect, activeMarks, onToggleMark, onPinCh data-inline-toolbar className="fixed z-50 flex items-center gap-0.5 rounded-lg border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 shadow-md px-1 py-1" style={{ top: pos.top, left: pos.left }} - onMouseDown={(e) => e.preventDefault()} > {SIMPLE_BUTTONS.map(btn => (