Selecting text in an article via double-click triggers detail view

Infos:

  • Used Zammad version: 2.9.x
  • Used Zammad installation source: docker-compose
  • Operating system: Debian 9
  • Browser + version: Chrome 74

Expected behavior:

  • Double-clicking on a word in an article and then dragging the mouse should allow the user to make a whole-word selection. Like this:

Actual behavior:

  • Double-clicking on a word in an article triggers the detail view that shows from/to/subject. This can be pretty annoying while trying to select text.

Steps to reproduce the behavior:

  • Attempt to select text with double click :slight_smile:

I’ve looked into the code because I was curious if this is easy to fix. I’ve found that there is actually code that is supposed to prevent this (which probably makes this a bug report and not a feature request :smiley:):

Apparently, the 120ms delay was a bit too optimistic. The following debug code shows the delay that I’m getting when double-clicking:

zammad@martin ~ (develop) % git diff
diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee
index f5da7281e..ab60d81fc 100644
--- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee
+++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee
@@ -293,6 +293,9 @@ class ArticleViewItem extends App.ObserverController
     # by adding a delay to the toggle
     delay = 120

+    diff = +new Date - @lastClick
+    console.log("toggleMetaWithDelay - diff: " + diff)
+
     if @lastClick and +new Date - @lastClick < delay
       clearTimeout(@toggleMetaTimeout)
     else
application.js:42910 toggleMetaWithDelay - diff: 1314
application.js:42910 toggleMetaWithDelay - diff: 146
application.js:42910 toggleMetaWithDelay - diff: 862
application.js:42910 toggleMetaWithDelay - diff: 136
application.js:42910 toggleMetaWithDelay - diff: 2909
application.js:42910 toggleMetaWithDelay - diff: 128
application.js:42910 toggleMetaWithDelay - diff: 1414
application.js:42910 toggleMetaWithDelay - diff: 141
application.js:42910 toggleMetaWithDelay - diff: 1920
application.js:42910 toggleMetaWithDelay - diff: 136
application.js:42910 toggleMetaWithDelay - diff: 1608
application.js:42910 toggleMetaWithDelay - diff: 161
application.js:42910 toggleMetaWithDelay - diff: 1894
application.js:42910 toggleMetaWithDelay - diff: 144
application.js:42910 toggleMetaWithDelay - diff: 1480
application.js:42910 toggleMetaWithDelay - diff: 126

The high values are the delays between my double-clicks, and the low values are the delays between the separate clicks that constitute a double-click. As you can see, I haven’t actually managed to make a double-click with a delay of <= 120ms. I went ahead and raised the delay a bit:

zammad@martin.mein-iserv.de ~ (develop) % git diff
diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee
index f5da7281e..b13437200 100644
--- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee
+++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee
@@ -291,7 +291,7 @@ class ArticleViewItem extends App.ObserverController
   toggleMetaWithDelay: (e) =>
     # allow double click select
     # by adding a delay to the toggle
-    delay = 120
+    delay = 300

     if @lastClick and +new Date - @lastClick < delay
       clearTimeout(@toggleMetaTimeout)

This seems to greatly improve the situation, although it does of course result in a slightly higher delay when you actually want to expand the detail view.

1 Like

Haha oh wow, never experienced that by now.
Was going to ask what Browser you use but then noticed, that your double click is “slow” (well slower than mine).

If I force myself into slow double clicking, I can verify that.
Would you mind creating an issue and, maybe, also a PR? :slight_smile:

Makes me a bit curious what your average double-click delay is ^^

https://stopwatch.onlineclock.net/games/howfast/

I’m getting:

1 Stop: 00:00:00.137
2 Stop: 00:00:00.127
3 Stop: 00:00:00.120
4 Stop: 00:00:00.139
5 Stop: 00:00:00.118
6 Stop: 00:00:00.133

Maybe it’s dependent on the mouse? I’m using a rather cheap Cherry Gentix mouse in the office.

Done:


Nope, maybe just my browser being laggy because… well. tabs… :smiley:

1 Stop: 00:00:00.172
2 Stop: 00:00:00.295
3 Stop: 00:00:00.233
4 Stop: 00:00:00.221
5 Stop: 00:00:00.311
6 Stop: 00:00:00.209
7 Stop: 00:00:00.189
8 Stop: 00:00:00.194

I’m using some rather Mouse, but that shouldn’t affect the click rate (not using macros or rapid fire magic :stuck_out_tongue: )

Thanks for the issue and PR <3

1 Like

I’m using a simple hp mouse while beeing kinda “slow” and it’s working fine for me.

1 Stop: 00:00:00.160
2 Stop: 00:00:00.127
3 Stop: 00:00:00.160
4 Stop: 00:00:00.151
5 Stop: 00:00:00.152
6 Stop: 00:00:00.137

Kinda strange phenomenon :thinking:
Nice work though, this was kinda enteraining :smiley:

cheers

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.