Open Bug 1640604 Opened 4 years ago Updated 4 years ago

Let DevTools handle Ctrl/Cmd+W

Categories

(DevTools :: Debugger, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: sebo, Unassigned)

References

Details

Currently, pressing the shortcut Ctrl/Cmd+W while the DevTools are focussed closes the current browser Tab, except in the Debugger where it closes the currently opened file.

This is an inconsistency and may cause confusions and frustrations for users if they expected to only close the currently opened file in the Debugger.

See also the related question on Stack Overflow.

There are two suggestions how to solve this:

  1. Do nothing in panels that don't have tabs, and close the currently open tab for those which have tabs (currently only the Debugger).
  2. Always close the file currently opened in the Debugger even when another panel is focused.

Personally, I prefer the first option because it is future proof in case any other panels (like the Style Editor, for example) get tabs at some point, and the user gets direct feedback on the action.

Sebastian

I agree about the inconsistency. I am not a big fan of the decision to reuse the CtrlOrCmd+W shortcut to close files in the Debugger.
Everytime I try to cmd+w while I have the Debugger focused, I expect my browser tab to be closed and I have to pause for a second to understand why it didn't work.

So IMO we have a third option here, which is to use another shortcut for the debugger, and leave CtrlOrCmd+W to the browser.

(In reply to Julian Descottes [:jdescottes] from comment #1)

So IMO we have a third option here, which is to use another shortcut for the debugger, and leave CtrlOrCmd+W to the browser.

Of course that is also a viable solution. For reference, the Chrome DevTools use Alt/Option+W for closing files in their Sources panel and Ctrl/Cmd+W for closing the current browser tab.

Sebastian

(I'm the person who raised that StackOverflow question)

Everytime I try to cmd+w while I have the Debugger focused, I expect my browser tab to be closed and I have to pause for a second to understand why it didn't work.

My experience is basically the opposite. I've been bitten so many times by having the whole browser tab close (losing my whole debugger state) that I never use Cmd-W at all.

And the fact that this command only works while the debugger source window is focused (not the console, not the file tree) makes it even less predictable and useful.

Something like Cmd-Shift-W maybe?

Just some thoughts without a final answer:

  • On a rule of least surprise, closing debugger tabs is less impactful than closing the whole tab.
  • Focus in devtools is tricky as it is, as users constantly click between site and devtools to debug. This also makes shortcuts depending on specific focus more tricky to make predictable.
  • The inconsistent feelings seem to come from the fact that the shortcut is also captured when the console is focused. It could be limited to when the cursor is actually in a file or at least in the actual Debugger UI.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: General → Debugger

I implemented this feature originally. Thoughts:

  1. The debugger is a tabbed interface and CTRL/CMD+W is a "close tab" paradigm in browsers, text editors, etc., so I would expect to be able to close a debugger tab when pressed.

  2. If a user expects CTRL/CMD+W to close a debugger tab, but it closes the entire tab, that's a total loss of debugging state -- you'd have to re-open the page and then do your flow all over again. If you expect those keys to close the entire browser tab, and it simply closes a debugger tab, you learn the feature and then can close the overall tab in a more lossy way.

I'm happy to remove it but it will result in a harsher experience.

As with all shortcuts, it is hard to tell what the impact will be without data. We'd probably need to land some event telemetry (close debugger file + how it got closed) to see if Ctrl-W is commonly used and if some usage closes all files. If very few devs close files in debugger using that shortcut and/or if most that use it close all files in repetition, we'd have a case for stripping this out.

Flags: needinfo?(dwalsh)
Depends on: 1647346

I'm happy to instrument telemetry for this keyboard usage. Please let me know if it's possible for me to set up the telemetry info, or if I need to get that from someone else :)

Flags: needinfo?(dwalsh)

Pinging Harald re: telemetry.

Flags: needinfo?(hkirschner)

David, does bug 1647346 cover the work or do we need to track anything else?

Flags: needinfo?(hkirschner)
Assignee: nobody → dwalsh
Severity: -- → S3
Status: NEW → ASSIGNED
Priority: -- → P2
Assignee: dwalsh → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.