Skip to content

Commit

Permalink
Fix CB reloading when vis-selector opened (#9192)
Browse files Browse the repository at this point in the history
Fixes a bug blocking #8570.
  • Loading branch information
kazcw committed Feb 26, 2024
1 parent f48caac commit e4383cb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/ide-desktop/lib/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,18 @@ function AppRouter(props: AppProps) {
!(event.target instanceof HTMLTextAreaElement) &&
!(event.target instanceof HTMLElement && event.target.isContentEditable)
) {
document.getSelection()?.removeAllRanges()
const selection = document.getSelection()
const app = document.getElementById('app')
const appContainsSelection =
app != null &&
selection != null &&
selection.anchorNode != null &&
app.contains(selection.anchorNode) &&
selection.focusNode != null &&
app.contains(selection.focusNode)
if (selection != null && !appContainsSelection) {
selection.removeAllRanges()
}
}
}
const onSelectStart = () => {
Expand Down

0 comments on commit e4383cb

Please sign in to comment.