File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -119,14 +119,19 @@ export function initGlobalCommon() {
119119 $ ( $ ( this ) . data ( 'target' ) ) . slideToggle ( 100 ) ;
120120 } ) ;
121121
122- // make table <tr> element clickable like a link
123- $ ( 'tr[data-href]' ) . on ( 'click' , function ( ) {
124- window . location = $ ( this ) . data ( 'href' ) ;
125- } ) ;
126-
127- // make table <td> element clickable like a link
128- $ ( 'td[data-href]' ) . click ( function ( ) {
129- window . location = $ ( this ) . data ( 'href' ) ;
122+ // make table <tr> and <td> elements clickable like a link
123+ $ ( 'tr[data-href], td[data-href]' ) . on ( 'click' , function ( e ) {
124+ const href = $ ( this ) . data ( 'href' ) ;
125+ if ( e . target . nodeName === 'A' ) {
126+ // if a user clicks on <a>, then the <tr> or <td> should not act as a link.
127+ return ;
128+ }
129+ if ( e . ctrlKey || e . metaKey ) {
130+ // ctrl+click or meta+click opens a new window in modern browsers
131+ window . open ( href ) ;
132+ } else {
133+ window . location = href ;
134+ }
130135 } ) ;
131136}
132137
You can’t perform that action at this time.
0 commit comments