Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Ignore text selecting in data-tables

dominik-zeglenfaafef484036
diff --git a/saleor/static/dashboard/js/components/misc.js b/saleor/static/dashboard/js/components/misc.js
index 3e8af4571c..35880e463f 100644
--- a/saleor/static/dashboard/js/components/misc.js
+++ b/saleor/static/dashboard/js/components/misc.js
@@ -28,9 +28,15 @@ $('.btn-print').click((e) => {
});
// Clickable rows in dashboard tables
-$(document).on('click', 'tr[data-action-go]>td:not(.ignore-link)', (e) => {
- const $targetElement = $(e.currentTarget).parent();
- window.location.href = $targetElement.data('action-go');
+$(document).on('mouseup', 'tr[data-action-go] > td:not(.ignore-link)', (e) => {
+ const $target = $(e.currentTarget);
+ // Ignore selecting text
+ const selectedText = getSelection().toString();
+ if (selectedText === '' || selectedText === $target.data('ignore-text')) {
+ window.location.href = $target.parent().data('action-go');
+ } else {
+ $target.data('ignore-text', selectedText);
+ }
});
// Publish / unpublish lever in product detail view