fix: use currentTarget and contains() in blur handler per review

Use e.currentTarget instead of e.target so the reference is always the
contenteditable div, not a descendant <a> tag. Use el.contains() instead
of strict equality to avoid linkifying while focus is still inside the
editable element.

https://claude.ai/code/session_01VZceWPhHMHCA6SELBdCPfN
This commit is contained in:
Claude
2026-04-10 21:53:20 +02:00
committed by Fred Cabassut
parent 104c58adf1
commit 5c8d6e5b17
+2 -2
View File
@@ -325,9 +325,9 @@
onclick={handleLinkClick}
onpaste={handlePaste}
onblur={(e) => {
const el = e.target as HTMLElement;
const el = e.currentTarget as HTMLElement;
requestAnimationFrame(() => {
if (el.isConnected && document.activeElement !== el) {
if (el.isConnected && !el.contains(document.activeElement)) {
el.innerHTML = linkifyText(item.text);
}
});