File tree 1 file changed +17
-17
lines changed
tensorboard/webapp/widgets/custom_modal
1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -109,23 +109,23 @@ export class CustomModal {
109
109
const customModalRef = new CustomModalRef ( overlayRef ) ;
110
110
this . customModalRefs . push ( customModalRef ) ;
111
111
112
- // setTimeout to prevent closing immediately after modal open.
113
- setTimeout ( ( ) => {
114
- const outsidePointerEventsSubscription = overlayRef
115
- . outsidePointerEvents ( )
116
- . subscribe ( ( event ) => {
117
- // Only close when click is outside of every modal
118
- if (
119
- this . customModalRefs . every (
120
- ( ref ) =>
121
- ! isMouseEventInElement ( event , ref . overlayRef . overlayElement )
122
- )
123
- ) {
124
- this . closeAll ( ) ;
125
- }
126
- } ) ;
127
- customModalRef . subscriptions . push ( outsidePointerEventsSubscription ) ;
128
- } ) ;
112
+ const outsidePointerEventsSubscription = overlayRef
113
+ . outsidePointerEvents ( )
114
+ . subscribe ( ( event ) => {
115
+ // Prevent the right click mouseup event from immediately closing the modal.
116
+ if ( event . type === 'auxclick' ) return ;
117
+
118
+ // Only close when click is outside of every modal
119
+ if (
120
+ this . customModalRefs . every (
121
+ ( ref ) =>
122
+ ! isMouseEventInElement ( event , ref . overlayRef . overlayElement )
123
+ )
124
+ ) {
125
+ this . closeAll ( ) ;
126
+ }
127
+ } ) ;
128
+ customModalRef . subscriptions . push ( outsidePointerEventsSubscription ) ;
129
129
130
130
const keydownEventsSubscription = overlayRef
131
131
. keydownEvents ( )
You can’t perform that action at this time.
0 commit comments