feat(highlights): clear browser selection immediately after creating highlight

- Add window.getSelection().removeAllRanges() after highlight creation
- Ensures DOM can update immediately without selection interference
- Improves perceived responsiveness of highlight creation
This commit is contained in:
Gigi
2025-10-14 00:03:19 +02:00
parent 946584236d
commit 3b639e2783

View File

@@ -77,6 +77,12 @@ export const useHighlightCreation = ({
publishedRelays: newHighlight.publishedRelays
})
// Clear the browser's text selection immediately to allow DOM update
const selection = window.getSelection()
if (selection) {
selection.removeAllRanges()
}
highlightButtonRef.current?.clearSelection()
onHighlightCreated(newHighlight)
} catch (error) {