mirror of
https://github.com/dergigi/boris.git
synced 2026-01-21 15:54:30 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user