File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -803,7 +803,10 @@ class TouchSelectionMenuController {
803803 } else if ( text instanceof Node ) {
804804 $item . append ( text . cloneNode ( true ) ) ;
805805 }
806- $item . addEventListener ( "click" , ( event ) => {
806+ let handled = false ;
807+ const runAction = ( event ) => {
808+ if ( handled ) return ;
809+ handled = true ;
807810 event . preventDefault ( ) ;
808811 event . stopPropagation ( ) ;
809812 this . #handlingMenuAction = true ;
@@ -814,7 +817,9 @@ class TouchSelectionMenuController {
814817 this . #hideMenu( ) ;
815818 this . #view. focus ( ) ;
816819 }
817- } ) ;
820+ } ;
821+ $item . addEventListener ( "pointerdown" , runAction ) ;
822+ $item . addEventListener ( "click" , runAction ) ;
818823 this . $menu . append ( $item ) ;
819824 } ) ;
820825
@@ -901,8 +906,10 @@ class TouchSelectionMenuController {
901906 }
902907
903908 #hideMenu( force = false , clearActive = true ) {
904- if ( ! force && ! this . #menuActive) return ;
905- this . $menu . remove ( ) ;
909+ if ( ! force && ! this . #menuActive && ! this . $menu . isConnected ) return ;
910+ if ( this . $menu . isConnected ) {
911+ this . $menu . remove ( ) ;
912+ }
906913 if ( clearActive ) {
907914 this . #menuActive = false ;
908915 }
You can’t perform that action at this time.
0 commit comments