After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725123 - Add ability to close tab by middle-clicking on it
Add ability to close tab by middle-clicking on it
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: GtkNotebook
3.22.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
: 319503 606386 738998 776539 (view as bug list)
Depends on: 705487
Blocks:
 
 
Reported: 2014-02-25 07:08 UTC by Robert Roth
Modified: 2018-01-29 01:11 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Robert Roth 2014-02-25 07:08:13 UTC
The new look of the notebook tabs is awesome.

As a minor improvement, I would like to see the mouse middle click shortcut assigned to closing the clicked tab.
This is already used by various applications (none of them being native GTK+ apps, and I found myself trying to use it again and again while migrating to Web 3.12) like eclipse, Firefox, Chromium/e.
Comment 1 Michael Catanzaro 2014-10-22 15:22:10 UTC
*** Bug 319503 has been marked as a duplicate of this bug. ***
Comment 2 Michael Catanzaro 2014-10-22 15:23:03 UTC
*** Bug 738998 has been marked as a duplicate of this bug. ***
Comment 3 Simone Tolotti 2015-04-27 07:56:26 UTC
IMHO it is a 'de facto' standard so could be a good choice to implement this.
I'll try to use it every time in both nautilus and epiphany.
Comment 4 Matthias Clasen 2015-05-01 01:49:57 UTC
I'm not convinced that binding a destructive action to a bare click is a good idea.
Comment 5 Lasse Schuirmann 2015-05-01 11:35:24 UTC
(In reply to Matthias Clasen from comment #4)
> I'm not convinced that binding a destructive action to a bare click is a
> good idea.

We could provide an undo operation here anyways. If we do that this is ok IMO, e.g. we have the same operation if the user clicks on the x or presses Ctrl+W. That we don't have an undo popup or so is a major design flaw and inconsistency on this IMO - be forgiving with the user. (Gets even worse with Ctrl+Q.)


Let me try to summarize all the arguments for/against this, much of this coming from the long (heated) discussion on the duplicates:

+ "You leave a mouse button with NO FUNCTION when every other browser make it useful"
+ Many people will expect it to close the tab because they know it from other tabbed applications (not only browsers).
+ "It's especially useful if you're closing many tabs at once."
+ This feature is wanted by many people and keeps many from switching to epiphany, including me.

- People may accidentally close tabs and panic.
  + A tab is just a view on some data, i.e. no data is lost for the user.
  + We can (and should) provide an undo operation as we do for all destructive operations. We should do this anyway when a tab gets closed. Related bug, although filed in the wrong product: https://bugzilla.gnome.org/show_bug.cgi?id=738997
  + "It's no more destructive or undiscoverable than, say, Ctrl+W or Ctrl+Q"
- It was stated: "it violates HIG", I didn't found any further reference or any reason.

Please note that this summary is probably biased since I'm obviously in favor of adding this feature. I'm just trying to get and share an overview over pros and cons.
Comment 6 Emmanuele Bassi (:ebassi) 2015-05-01 11:45:00 UTC
(In reply to Lasse Schuirmann from comment #5)
> (In reply to Matthias Clasen from comment #4)
> > I'm not convinced that binding a destructive action to a bare click is a
> > good idea.
> 
> We could provide an undo operation here anyways.

Not really, without involving applications anyway.

The notebook widget has not idea what a tab contains, or what the application may or may not do when the tab is removed.

If we're getting into application functionality territory, then the application may as well provide a middle click pointer handler.

> + "You leave a mouse button with NO FUNCTION when every other browser make
> it useful"

This is not a reason. We don't have a function for every one of the 105 keys on my keyboard either.

> + Many people will expect it to close the tab because they know it from
> other tabbed applications (not only browsers).

> + This feature is wanted by many people and keeps many from switching to
> epiphany, including me.

These are the same reason.

> + "It's especially useful if you're closing many tabs at once."

That is debatable.
 
> - People may accidentally close tabs and panic.
>   + A tab is just a view on some data, i.e. no data is lost for the user.

That's unknown to the toolkit. A tab is a widget, from the perspective of GTK+; what the widget does, contains, or implies, it's all application-only knowledge.

>   + We can (and should) provide an undo operation as we do for all
> destructive operations. We should do this anyway when a tab gets closed.

The only way to do this is to keep a widget alive for a while after some user interaction, which means that from an application's perspective the widget is not destroyed immediately on close; since the widget is still alive, just "not visible" — with every complication that it entails. Do we mark it invisible? Do we just skip it when doing layout/draw operations? What about gtk_container_get_children()? — then the application may still try to operate on it because of timeouts or threads, at which point the tab may still try to do things like access the parent widget, or schedule an update.
Comment 7 Lasse Schuirmann 2015-05-01 12:14:25 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #6)
> (In reply to Lasse Schuirmann from comment #5)
> > (In reply to Matthias Clasen from comment #4)
> > > I'm not convinced that binding a destructive action to a bare click is a
> > > good idea.
> > 
> > We could provide an undo operation here anyways.
> 
> Not really, without involving applications anyway.
> 
> The notebook widget has not idea what a tab contains, or what the
> application may or may not do when the tab is removed.
> 
> If we're getting into application functionality territory, then the
> application may as well provide a middle click pointer handler.
> 
> > + "You leave a mouse button with NO FUNCTION when every other browser make
> > it useful"
> 
> This is not a reason. We don't have a function for every one of the 105 keys
> on my keyboard either.

It is not indeed. IMO it is an opportunity, it provides a very short way for a very common action. (Primary actions for the tabs themselves are opening and closing.)

Having the middle click as a close action and a "Reopen last tab" action makes, especially in web browsers, the tabs feel way more lightweight. It feels more like playing with them than working with them. Of course this only my perception.

> > + Many people will expect it to close the tab because they know it from
> > other tabbed applications (not only browsers).
> 
> > + This feature is wanted by many people and keeps many from switching to
> > epiphany, including me.
> 
> These are the same reason.
> 
> > + "It's especially useful if you're closing many tabs at once."
> 
> That is debatable.

Maybe we can agree on summarizing the above three points to one: many people would like this and find it useful, some consider it an important feature for daily use.

> > - People may accidentally close tabs and panic.
> >   + A tab is just a view on some data, i.e. no data is lost for the user.
> 
> That's unknown to the toolkit. A tab is a widget, from the perspective of
> GTK+; what the widget does, contains, or implies, it's all application-only
> knowledge.

That is of course right.

> >   + We can (and should) provide an undo operation as we do for all
> > destructive operations. We should do this anyway when a tab gets closed.
> 
> The only way to do this is to keep a widget alive for a while after some
> user interaction, which means that from an application's perspective the
> widget is not destroyed immediately on close; since the widget is still
> alive, just "not visible" — with every complication that it entails. Do we
> mark it invisible? Do we just skip it when doing layout/draw operations?
> What about gtk_container_get_children()? — then the application may still
> try to operate on it because of timeouts or threads, at which point the tab
> may still try to do things like access the parent widget, or schedule an
> update.

So considering that we seem to agree on:

 * This whole middle click discussion depends a lot on the undoability of the action.
 * An undoable tab close is desirable.
 * The application would need to be aware of the undoability.

I'm not into the technical details here. Couldn't we offer the application to pass a parameter to make the closing undoable? Which would be hiding it somehow, call back to the application to let it show the undo switch. As the application is aware of this it would be its responsibility to not operate on/from this widget while it is in a hidden state.
Comment 8 Matthias Clasen 2015-05-01 12:27:08 UTC
Just to put this in perspective: We currently have no support for closing tabs in GtkNotebook anyway. If you see a close button in a notebook tab, its because an application put it there.
Comment 9 Juraj Fiala 2015-05-20 16:29:45 UTC
I would like to provide what I hope is a strong argument, since I would really like to see this feature implemented:

Try asking your family and friends if they know that the scroll wheel is clickable. You would be surprised how many of them have no idea, and it's usually those kind of people that would close something by accident and panic.

If you tell them that you can use it to close and open new tabs in a browser, some will say that's incredibly cool and will use it all the time, but most of them will never use the middle mouse button anyway, in case it breaks something.
Comment 10 Sebastián 2016-04-02 19:19:39 UTC
I see, but I think that the button is in the tab is for new or casual users. An advanced user can find better to close a tab by using a middle click. If you need to work faster, any millisecond you can save, the better. It would be good to have it not only on gnome web, but also on every gtk app that it uses tabs.
Comment 11 Juraj Fiala 2016-04-02 19:21:33 UTC
(In reply to Sebastián from comment #10)
> I see, but I think that the button is in the tab is for new or casual users.

Note that I'm not arguing against the close button ;)
Comment 12 Sebastián 2016-04-02 21:05:41 UTC
Sorry Juraj, my response was for Comment 8. I don't know how to do it properly. :)
Comment 13 Juraj Fiala 2016-04-03 05:44:45 UTC
(In reply to Sebastián from comment #12)
> Sorry Juraj, my response was for Comment 8. I don't know how to do it
> properly. :)

S'all right ;) you just click the [reply] button on the right.
Comment 14 Michael Catanzaro 2016-12-28 18:15:58 UTC
*** Bug 776539 has been marked as a duplicate of this bug. ***
Comment 15 Daniel Boles 2017-06-24 16:27:20 UTC
*** Bug 784168 has been marked as a duplicate of this bug. ***
Comment 16 Dan Jacobson 2017-06-28 01:05:19 UTC
Users from ANY other browser moving to epiphany ALL will encounter this bug.
Please fix it fast.
Thank you.
It is too hard to retrain oneself to use CTRL-w, as that is the only other way to close a tab that works in all browsers... as users do still use other browsers at the same time as epiphany.
Comment 17 Dan Jacobson 2017-06-28 01:08:23 UTC
Perhaps have a configuration variable for users who prefer some other behavior, but please fix it fast for the rest of us. Just today I have already clicked it like a dummy many times.
Comment 18 Dan Jacobson 2017-06-28 01:10:17 UTC
I even middle clicked again to close this window after completing this bug report.

You know the only reason I'm using this dear browser is because I'm on an older computer, and midori is no longer maintained.
Comment 19 Dan Jacobson 2017-06-28 01:13:34 UTC
I recall other browsers probably don't even have an X anymore to close a tab as it wastes space on the tab, but I might be dreaming.
Comment 20 Daniel Boles 2017-06-28 07:12:05 UTC
(In reply to Dan Jacobson from comment #19)
> I recall other browsers probably don't even have an X anymore to close a tab
> as it wastes space on the tab, but I might be dreaming.

You are. Firefox has Xs, though it hides them at high numbers of tabs to save space. Chrome doesn't even do that, so eventually the Xs are all you can see at high counts. I don't know what IE/Edge/others do.

As someone who myself needs to remember the same thing: Please try to wait a few minutes and collect all your thoughts to send in one message. That way, everyone else of us who is subscribed to the thread will only get 1 email, not 4.
Comment 21 Emmanuele Bassi (:ebassi) 2017-06-28 08:20:00 UTC
The only reason this bug has been left open is because of bug 705487: if we are *ever* to add a way to show a way to remove a GtkNotebook tab from the tab itself, then we may reconsider this.

Personally, I think it's pretty much pointless; bug 705487 is kind of lightweight on the details, and nobody has elaborated on that, either.

Additionally, this is never going to happen for GTK+ 3.x, and for GTK+ 4.x we may start writing a new "tabbed" GtkStack switcher widget altogether. In any case, I'd still contend that this kind of behaviour ought to be in the application's territory, not in the toolkit, because the semantics around it are far too application-specific.

To summarise:

 - if you want to add middle-click to close a tab to an application using GtkNotebook with close buttons on each tab, then open a bug against the application; putting a GtkEventBox as the tab widget is a fairly simple matter, and that allows intercepting middle-button clicks on the tab label.

GTK+ has no involvement in this, and won't have, for the foreseeable future.
Comment 22 Daniel Boles 2017-06-28 08:44:08 UTC
My bad. I used this as the dupe because I saw Michael did the same thing with a previous Epiphany bug.

If anyone wants to reopen this for Epiphany, I guess they should use the oldest duplicate? The one I found was: https://bugzilla.gnome.org/show_bug.cgi?id=606386

For posterity:

(In reply to Daniel Boles from comment #20)
> Chrome doesn't even do that, so eventually the Xs are all you
> can see at high counts.

Chrome does also have Xs normally, until the tab count gets high. I was thinking of how it never makes its tabs scrollable or collapsed to a menu, so they pile up forever until you can only see the favicon.

> I don't know what IE/Edge/others do.

IE seems to reserve space for the X but only show it when the tab is active or hovered.
Comment 23 Dan Jacobson 2017-06-28 13:19:23 UTC
OK I tried to reopen bug 606386 as you said but I am not staff so please do it for me.
Comment 24 Michael Catanzaro 2017-06-28 13:46:49 UTC
*** Bug 606386 has been marked as a duplicate of this bug. ***
Comment 25 Matthias Clasen 2017-06-28 18:15:17 UTC
This is not going to appear as a GtkNotebook feature. If you want it in an application, it needs to be implemented there. If you don't want it in the application, I would suggest closing bugs as WONTFIX, rather than duplicating them on this one, which is only misleading the bug reporters into blaming GTK+ for the failure of the application to implement this...
Comment 26 Dan Jacobson 2017-06-29 00:51:59 UTC
So it needs to be implemented in Epiphamy.
So please reopen my Bug 784168.
Comment 27 Dan Jacobson 2017-06-29 00:53:38 UTC
OK I reopened Bug 784168.
Comment 28 Juraj Fiala 2017-07-25 08:27:13 UTC
Hm, I thought of this bug more as a design problem, as a destructive middle-click is a really powerful thing for advanced users, with almost no danger of accidental using by the casual user. Maybe it would be good to move this bug elsewhere?
Comment 29 Daniel Boles 2017-07-25 08:45:01 UTC
It is a design problem, in the sense that it must be implemented by applications, and applications follow the HIG. Probably the best thing to do is ask on #gnome-design and see what current opinion is. I guess it's currently a 'no' though, otherwise we'd probably already have been linked to a wiki page on it or similar.

I'm also not sure that an accident is as unlikely as you think. (However, having an action to undo the last closed tab makes it something of a moot point anyway.)
Comment 30 Dan Jacobson 2018-01-29 01:11:56 UTC
What's worse is in other browsers one can just **without moving the mouse** middle click many times to close many tabs.

Even though each successive tab is a slightly different width, the wide target area ensures that each one slides over and can be hit.

On the other hand, with just a X as target area, the mouse must be repositioned each time.