kyw's solution is fairly sophisticated but in case of double click both events, double and single clicks are identified. Seems to me, in order to make the double click override a single click, the solution based on a timer is required.
@sibertauthorMar 24.2022 — #> @Sempervivum#1643297 Seems to me, in order to make the double click override a single click, the solution based on a timer is required.
Yes, if you want to clear click and double click this may be needed. But I can think of this as a benefit that single click selects the table row and double click is doing something else with this row.
I tried to implement this in my code and getting some odd behavior
1. The single click is not fired first time. (double event?)
@SempervivumMar 24.2022 — #When assigning an event listener inside the callback of another one, the behavior is difficult to predict.
I changed your code to this: ``<i> </i> document.addEventListener('click', event => { const row = event.target.closest('tr'); let moreClicked = false; if (row) { console.log('click on row'); if (event.detail === 1) { if (event.target.classList.contains('more')) { id = row.dataset.id; popup(event.target); moreClicked = true; console.log('1st click on more') } } else if (event.detail === 2) { console.log('double click on row') } } if (!moreClicked) { popupmenu.classList.add('hide'); } });<i> </i>`` and it works as expected. However I do not know what behavior you intend to achieve.