Skip to content

Commit a9b15b1

Browse files
authored
Merge pull request #42961 from dominictb/fix/41197
chore: remove all selection ranges during navigation
2 parents 13fedce + e0e797f commit a9b15b1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libs/Navigation/NavigationRoot.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N
135135

136136
// We want to clean saved scroll offsets for screens that aren't anymore in the state.
137137
cleanStaleScrollOffsets(state);
138+
139+
// clear all window selection on navigation
140+
// this is to prevent the selection from persisting when navigating to a new page in web
141+
// using "?" to avoid crash in native
142+
window?.getSelection?.()?.removeAllRanges?.();
138143
};
139144

140145
return (

0 commit comments

Comments
 (0)