mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Fix the click behavior for <tr> and <td> with [data-href] (#17388)
This commit is contained in:
		| @@ -119,14 +119,19 @@ export function initGlobalCommon() { | |||||||
|     $($(this).data('target')).slideToggle(100); |     $($(this).data('target')).slideToggle(100); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   // make table <tr> element clickable like a link |   // make table <tr> and <td> elements clickable like a link | ||||||
|   $('tr[data-href]').on('click', function () { |   $('tr[data-href], td[data-href]').on('click', function (e) { | ||||||
|     window.location = $(this).data('href'); |     const href = $(this).data('href'); | ||||||
|   }); |     if (e.target.nodeName === 'A') { | ||||||
|  |       // if a user clicks on <a>, then the <tr> or <td> should not act as a link. | ||||||
|   // make table <td> element clickable like a link |       return; | ||||||
|   $('td[data-href]').click(function () { |     } | ||||||
|     window.location = $(this).data('href'); |     if (e.ctrlKey || e.metaKey) { | ||||||
|  |       // ctrl+click or meta+click opens a new window in modern browsers | ||||||
|  |       window.open(href); | ||||||
|  |     } else { | ||||||
|  |       window.location = href; | ||||||
|  |     } | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user