terminal: Close tab shortcut (Ctrl+F4) doesn't work if window focus is not on title bar
Environment
Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
10.0.19042.685
Windows Terminal version (if applicable):
Latest preview.
Any other software?
Steps to reproduce
- Click
+in the title bar to create a new tab in Windows Terminal. - Press Ctrl+F4 to close the tab.
Expected behavior
The newly created tab is closed after Ctrl+F4.
Actual behavior
Nothing changed and the new tab still exists.
Seems Ctrl+F4 to close tab window only works if the tab/title bar has Window focus. For example, it works if I click tab title before pressing Ctrl+F4.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 16 (8 by maintainers)
Using Version: 1.7.1033.0
Not sure whether it was intended or not but there is a tooltip over the the tab’s [X] button that say closing is Ctrl + F4, but on a fresh install of the above, its not there.
Was able to add the command in the JSON file and then it works perfectly.
Can confirm the above, the tooltip says it on a fresh install but it’s not functional without the focus. Adding the “closeTab” binding works.
I don’t know what I was thinking closing this. Maybe because I was triaging at 5am?
Yea, we should unbind that from the TabView, so that Ctrl+F4 works in both the terminal content and in the tab view.
Now, how we remove that keybinding from the TabView is another question entirely.
HOLY GOSH.
The whole thesis of this bug is premised on a typo.
The keybinding should be
command. Notaction.That works perfectly fine in the terminal today. That’s what I get for triaging at 5am.
Not currently, and outside the context of this bug, I’m not sure there’s really a use case for that. I think it’d just be easier to solve the underlying bug then add the workaround 😉
I wonder if XAML is providing the <kbd>Ctrl+F4</kbd> keybinding themselves… Oh they are!
https://github.com/microsoft/microsoft-ui-xaml/blob/309c88f81cf23802d6406b452e4381fc9b4e9de1/dev/TabView/TabView.cpp#L38-L43
That’s certainly interesting.
I’d say in general, if you want <kbd>Ctrl+F4</kbd> to work to close a tab, I’d add a keybinding for it, since it’s not bound by default. That would look something like
(we use
closePanebecause it’s more versatile thancloseTab- it will close the tab if you only have one open tab, and work to close the pane if you have multiple panes)