Closed odebroqueville closed 10 months ago
Thank you for your suggestion. I thought of this already, but I found it hard to implement.
However, I looked further and found https://stackoverflow.com/questions/34611711/how-to-detect-an-empty-space-on-a-web-page which suggests using https://html2canvas.hertzen.com/
This is possible, but requires some more work and investigation.
Perhaps you can check the node type of e.target onclick. If it's different to text (3), then close the tab on next click(if e.clientX and e.clientY coordinates haven't changed) . https://www.w3schools.com/jsref/prop_node_nodetype.asp Although this isn't a full proof solution because it doesn't account for html elements (e.g. resizing of maps) where you wouldn't want to close tabs when double-clicking.
The nodetype returns 1 (element) most of the time, so that's of no use.
You gave me an idea though. element.innerText == "" seems to cover a lot of cases where you want to close the tab.
Sounds like the way to go. https://www.w3schools.com/jsref/prop_node_textcontent.asp
I will try with textContent instead, but innerText doesn't cover all cases.
Hi Geoffrey, I hope this message finds you well. I was looking at this review:
and also thought that it would be nice if default double-click behaviours (e.g. highlighting a word when double-clicking on text) weren't prevented. Maybe you could give your users the option to only close tabs when double-clicking on empty space on a web page.