File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -815,6 +815,22 @@ function initializeSideBarLinks() {
815815 loadSidebarLink ( link , { display : false , updateURL : false } ) ;
816816 }
817817 function onClick ( evt ) {
818+ // Let browser handle modified clicks
819+ if ( evt . ctrlKey || evt . metaKey || evt . shiftKey || evt . altKey ) {
820+ return ;
821+ }
822+
823+ // Let browser handle non-left clicks (middle click, right click)
824+ if ( evt . button !== 0 ) {
825+ return ;
826+ }
827+
828+ // Let browser handle links that open in new windows/tabs
829+ const link = evt . currentTarget ;
830+ if ( link . target && link . target !== "_self" ) {
831+ return ;
832+ }
833+
818834 evt . preventDefault ( ) ;
819835 loadSidebarLink ( link , { display : true , updateURL : true } ) ;
820836 }
@@ -851,6 +867,22 @@ function initializeContentLinks() {
851867 contentLink . removeEventListener ( "mouseover" , onMouseOver ) ;
852868 } ) ;
853869 function onClick ( evt ) {
870+ // Let browser handle modified clicks
871+ if ( evt . ctrlKey || evt . metaKey || evt . shiftKey || evt . altKey ) {
872+ return ;
873+ }
874+
875+ // Let browser handle non-left clicks (middle click, right click)
876+ if ( evt . button !== 0 ) {
877+ return ;
878+ }
879+
880+ // Let browser handle links that open in new windows/tabs
881+ const link = evt . currentTarget ;
882+ if ( link . target && link . target !== "_self" ) {
883+ return ;
884+ }
885+
854886 evt . preventDefault ( ) ;
855887 loadSidebarLink ( correspondingElt , {
856888 display : true ,
You can’t perform that action at this time.
0 commit comments