File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
packages/text-annotator/src Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ export const SelectionHandler = (
5050
5151 let lastDownEvent : Selection [ 'event' ] | undefined ;
5252
53+ let isContextMenuOpen = false ;
54+
5355 const onSelectStart = ( evt : Event ) => {
5456 if ( isLeftClick === false )
5557 return ;
@@ -152,6 +154,8 @@ export const SelectionHandler = (
152154 * to the initial pointerdown event and remember the button
153155 */
154156 const onPointerDown = ( evt : PointerEvent ) => {
157+ if ( isContextMenuOpen ) return ;
158+
155159 const annotatable = ! ( evt . target as Node ) . parentElement ?. closest ( NOT_ANNOTATABLE_SELECTOR ) ;
156160 if ( ! annotatable ) return ;
157161
@@ -178,6 +182,8 @@ export const SelectionHandler = (
178182 }
179183
180184 const onPointerUp = ( evt : PointerEvent ) => {
185+ if ( isContextMenuOpen ) return ;
186+
181187 const annotatable = ! ( evt . target as Node ) . parentElement ?. closest ( NOT_ANNOTATABLE_SELECTOR ) ;
182188 if ( ! annotatable || ! isLeftClick ) return ;
183189
@@ -227,6 +233,8 @@ export const SelectionHandler = (
227233 }
228234
229235 const onContextMenu = ( evt : PointerEvent ) => {
236+ isContextMenuOpen = true ;
237+
230238 const sel = document . getSelection ( ) ;
231239
232240 if ( sel ?. isCollapsed ) return ;
You can’t perform that action at this time.
0 commit comments