New issue
Advanced search Search tips

Issue 920902 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Today
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Cannot very rapidly close all tabs via middle click

Reported by dmitriy....@gmail.com, Jan 11

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3667.0 Safari/537.36

Steps to reproduce the problem:
1. Open a page with at least 4 images. From it, open 4 images on separate tabs.
2. Preferably (but not necessarily), go to tab 5, then 4, then 3, then 2 (in other words, click through all tabs with images).
3. Very rapidly middle click 4 times on a position where tab 2 is.

What is the expected behavior?
All tabs with images are gone, only one tab is still open.

What went wrong?
SOMETIMES (in 10-20% of cases), one or two tabs with images remain open. Maybe because animation of the tab to the right that is shifting to the position of closed tab is too slow, so on subsequent click there is no tab under mouse pointer. Or, maybe because the tab that needed to be closed is in fact still not finished closing and is still on tabstrip under mouse pointer when subsequent click happens.

Did this work before? No 

Chrome version: 73.0.3667.0  Channel: canary
OS Version: 10.0
Flash Version: 

It seems, looking through opened tabs makes closing them slower. 
It happens not only to tabs with images, but to any tabs, but problem with tabs with images seems to be more consistently repeatable.

Important for illustrating the problem is comparison with Firefox with disabled tab animations.
You may install Firefox (I used Nightly), go to about:config and change "toolkit.cosmeticAnimations.enabled" to "false", relaunch Firefox, and do the steps above. All tabs with images will always get closed - there is no such problem in Firefox with disabled animations.

The behavior above is easily and consistently repeatable via mouse recording software. For example, I used “Macro Recorder” https://www.macrorecorder.com/download.php . Two attached pictures show variants of mouse actions beginning with opening images from tab 1. “Without” pauses while closing tabs (which is faster then human can click), Firefox without animations always closes 3 or 4 tabs, Chrome always closes only one. With 10 ms pauses Firefox always closes all 4 tabs, Chrome always only 2. (My PC is i5-760, GTX 1050 Ti, 4K monitor with 150% scaling, Windows 10 x64).

The way I see it, there are several ways to fix that issue:
1. Memorize coordinates of each click over tabstrip, and “virtually” delay every subsequent click until currently running tabstrip animations complete.
2. Allow user to disable tab animations, like Firefox does (if animations are to blame).
3. Allow Chrome extensions to process double click over tab, so an extension could be written that closes all tabs to the right of the tab that is doubleclicked. Tab Mix Plus from preQuantum Firefox could do that and it was a perfect way to close several tabs at once – the first click activates nesessary tab, and immediate subsequent click signals that tabs to the right need to be closed.
4. “Virtually”, invisibly reposition click areas of tabs instantly, while leaving animation as is.
5. something else…

In my opinion, this is the single biggest problem with Chrome interface that can’t be solved by extensions, and it ruins feeling of speed, because it necessitates consciously making pauses in operations with interface.

Also, there was quite a similar bug report in 2010, it describes another way of dealing with the problem (which should have been  in effect already, in theory) https://bugs.chromium.org/p/chromium/issues/detail?id=44782
 
2019-01-11_06-40-08.png
54.7 KB View Download
2019-01-11_06-41-03.png
67.0 KB View Download
I was able to prove that the issue is due to animation of tabs shifting in place of closed tab.

If in step 3 you middle click near the RIGHT edge of tab 2, 4 times, 20 ms between clicks, then all 4 tabs with images will be closed.

However, if you middle click near the LEFT edge of tab 2, 4 times, 20 ms between clicks, then just 1 tab with image will be closed. That is because tabs to the right of tab 2, that was just closed with the first of four clicks, have greater distance to travel to get under mouse pointer in this case, so subsequent 3 clicks occur before any tab appears under mouse pointer.

This behavior can very easily be noticed even without automation tools, by simply rapidly middle clicking. Still, I’ve shown two macros that I’ve created in Macro Recorder to study this behavior with 100% repeatability, on screenshots.

Consequently, the easiest solution is to allow user to disable tab animations (at least tab close animations). A more difficult (and not necessarily better) solution is to move clickable areas of tabs INSTANTLY, independently from animations. And, in any case, allowing Chrome extensions to process double click on tab would be very useful.
2019-01-12_02-32-24.png
20.7 KB View Download
2019-01-12_02-27-49.png
20.9 KB View Download
2019-01-12_02-38-28.png
149 KB View Download
2019-01-12_02-44-16.png
68.7 KB View Download

Comment 2 Deleted

I also tried left clicking on tab close button 4 times 20 ms apart. Just one tab was closed! So, it is the same problem as with middle clicking left edge. That's because close button is small and has to travel almost full length of tab to get under mouse pointer.

Clicks have to be about 10 times slower, about 200 ms apart, to close all 4 tabs via close buttons.
2019-01-12_04-05-21.png
21.0 KB View Download
2019-01-12_04-12-43.png
82.6 KB View Download
Another solution, completely harmless to the current user experience, is this:

As soon as user orders tab 2 to be closed, instantly expand invisible clickable area of tab 3 to include empty space left from tab 2 (it turns out, it's currently not visually empty) while animation is running.

It will not help to close tabs more rapidly with tab close buttons though (unless a button's clickable area is temporarily expanded as well).
2019-01-12_13-01-54 (2).png
51.0 KB View Download
Components: -UI UI>Browser>TabStrip
Labels: Needs-Triage-M73
dmitry@ Thank you for very detailed analysis. I looked over this and found that this is more than animation. Actually we do try closing the next tab if the clicked tab is already closing. But It seems we have sort of timing problem related to beforeunload handler. We mark a tab is closing only after it passes beforeunload. I think this is why some of clicks are dropped. Firefox seems to force closing when multiple middle clicks come in. Maybe we can do similar things when fast-unload is enabled. 

Peter@ WDYT?
Hmmm.  Maybe the check for "closing" we make for "send middle-click to next tab" should return true even if there's a beforeunload handler running?  I don't know where this bit is set or how many people check it so I'm not sure how deep it would be safe to make this change, but it certainly seems like for the purpose of closing tabs repeatedly we want to treat these as "closing".

Comment 9 by sangwoo108@chromium.org, Jan 16 (6 days ago)

Thank you, Peter. I dug into this more and beforeunload handler doesn't seem to be a dominant problem :( Rather, tabs marked closing are not targeted during event dispatching as they're moved into closing_tabs_map_. This would be most of the cases where we can't close tabs with rapid middle click.

Here's a CL you can try. https://chromium-review.googlesource.com/c/chromium/src/+/1414743 

Comment 10 by sangwoo108@chromium.org, Today (67 minutes ago)

Status: Fixed (was: Unconfirmed)

Sign in to add a comment