mirror of
https://github.com/bretzel-app/crumbs.git
synced 2026-10-12 20:06:57 +02:00
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:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user