File tree 1 file changed +13
-8
lines changed
1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -119,14 +119,19 @@ export function initGlobalCommon() {
119
119
$ ( $ ( this ) . data ( 'target' ) ) . slideToggle ( 100 ) ;
120
120
} ) ;
121
121
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
+ }
130
135
} ) ;
131
136
}
132
137
You can’t perform that action at this time.
0 commit comments