فهرست منبع

Merge pull request #14544 from greggman/no-cmd-click-navigation

Prevent navigation if modifiers pressed.
Mr.doob 7 سال پیش
والد
کامیت
af9bfe144d
2فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 6 2
      docs/index.html
  2. 1 1
      examples/index.html

+ 6 - 2
docs/index.html

@@ -93,8 +93,12 @@
 				link.setAttribute( 'target', 'viewer' );
 				link.addEventListener( 'click', function ( event ) {
 
-					window.location.hash = pageURL;
-					panel.classList.add( 'collapsed' );
+					if ( event.button === 0 && !event.ctrlKey && !event.altKey && !event.metaKey ) {
+
+						window.location.hash = pageURL;
+						panel.classList.add( 'collapsed' );
+
+					}
 
 				} );
 

+ 1 - 1
examples/index.html

@@ -296,7 +296,7 @@
 			link.setAttribute( 'target', 'viewer' );
 			link.addEventListener( 'click', function ( event ) {
 
-				if ( event.button === 0 ) {
+				if ( event.button === 0 && !event.ctrlKey && !event.altKey && !event.metaKey ) {
 
 					selectFile( file );