Close command palette on focus loss #11524

Closed
opened 2026-01-31 02:50:05 +00:00 by claunia · 7 comments
Owner

Originally created by @Don-Vito on GitHub (Nov 21, 2020).

Description of the new feature/enhancement

Currently we dismiss command palette programmatically if user clicks in the bounds of "Tab Content" (second grid row of the terminal page), however if the click is performed outside of these boundaries (e.g., outside of the terminal window or in the tab row) we do not dismiss the palette.

And this is problematic for many reasons.

Here is the simplest example - opening a tab while palette is open leaves it open an without a focus (meaning it can be closed only with mouse):

PaletteLostFocusOpenTab

Same can be achieved by clicking on menu, and then click outside of it (but now you cannot even type)

PaletteLostFocusOpenMenu

Same of course happens for the tab switcher
PaletteLostFocus

This might might be a root cause for https://github.com/microsoft/terminal/issues/8319.

The idea here is to close the palette upon focus loss.
There are two approaches to it:

  1. Close the palette upon focus loss - this approach is taken in VS Code.
  • This approach is more hermetic
  • This approach introduces a more significant change in user experience, since now clicking another window closes the palette
  1. Close palette when clicking on the tab row (or more precisely on any row of the terminal page which is not the one that palette resides in)
  • This will have lesser impact on the experience
  • But it will not help us if the focus is somehow lost no by clicking
  1. Close palette when tabs items are modified
Originally created by @Don-Vito on GitHub (Nov 21, 2020). # Description of the new feature/enhancement Currently we dismiss command palette programmatically if user clicks in the bounds of "Tab Content" (second grid row of the terminal page), however if the click is performed outside of these boundaries (e.g., outside of the terminal window or in the tab row) we do not dismiss the palette. And this is problematic for many reasons. Here is the simplest example - opening a tab while palette is open leaves it open an without a focus (meaning it can be closed only with mouse): ![PaletteLostFocusOpenTab](https://user-images.githubusercontent.com/4639110/99885047-eb292680-2c3a-11eb-9d6f-3264abaaf0c3.gif) Same can be achieved by clicking on menu, and then click outside of it (but now you cannot even type) ![PaletteLostFocusOpenMenu](https://user-images.githubusercontent.com/4639110/99885050-ef554400-2c3a-11eb-9f50-c1763303a893.gif) Same of course happens for the tab switcher ![PaletteLostFocus](https://user-images.githubusercontent.com/4639110/99885175-c3868e00-2c3b-11eb-85e5-a0c185455ee0.gif) This might might be a root cause for https://github.com/microsoft/terminal/issues/8319. The idea here is to close the palette upon focus loss. There are two approaches to it: 1. Close the palette upon focus loss - this approach is taken in VS Code. * This approach is more hermetic * This approach introduces a more significant change in user experience, since now clicking another window closes the palette 2. Close palette when clicking on the tab row (or more precisely on any row of the terminal page which is not the one that palette resides in) * This will have lesser impact on the experience * But it will not help us if the focus is somehow lost no by clicking 3. Close palette when tabs items are modified
Author
Owner

@DHowett commented on GitHub (Nov 21, 2020):

My opinion: we should definitely do (1). It’s an ephemeral UI, users should not expect that it will hang around forever.

@zadjii-msft what does Sublime do?

@DHowett commented on GitHub (Nov 21, 2020): My opinion: we should definitely do (1). It’s an ephemeral UI, users should not expect that it will hang around forever. @zadjii-msft what does Sublime do?
Author
Owner

@Don-Vito commented on GitHub (Nov 21, 2020):

I am checking how to do it hypothetically (less trivial than I thought, as dismissing the palette auto focuses the tab content, eventually dismissing menus, etc.).. so if @zadjii-msft likes this approach I will probably have some draft..
I guess we will need to do both 1 and 3 (because closing tab doesn't modify the focus)..

@Don-Vito commented on GitHub (Nov 21, 2020): I am checking how to do it hypothetically (less trivial than I thought, as dismissing the palette auto focuses the tab content, eventually dismissing menus, etc.).. so if @zadjii-msft likes this approach I will probably have some draft.. I guess we will need to do both 1 and 3 (because closing tab doesn't modify the focus)..
Author
Owner

@Don-Vito commented on GitHub (Nov 22, 2020):

@zadjii-msft - if you like the idea I have the code.. but it is probably the worst one I wrote since I was 10: there are several small nuances that I had to handle each one of them.. probably there is some better solution, but I am still not in enough to see it.

@Don-Vito commented on GitHub (Nov 22, 2020): @zadjii-msft - if you like the idea I have the code.. but it is probably the worst one I wrote since I was 10: there are several small nuances that I had to handle each one of them.. probably there is some better solution, but I am still not in enough to see it.
Author
Owner

@Don-Vito commented on GitHub (Nov 23, 2020):

Added the PR Draft so it won't get lost.

@Don-Vito commented on GitHub (Nov 23, 2020): Added the PR Draft so it won't get lost.
Author
Owner

@zadjii-msft commented on GitHub (Nov 23, 2020):

(I want to get back to this before the EOD but I'm also worried I might not, and I'm about to start a 6 day vacation. Just wanted to give a heads up)

@zadjii-msft commented on GitHub (Nov 23, 2020): (I want to get back to this before the EOD but I'm also worried I might not, and I'm about to start a 6 day vacation. Just wanted to give a heads up)
Author
Owner

@Don-Vito commented on GitHub (Nov 23, 2020):

(I want to get back to this before the EOD but I'm also worried I might not, and I'm about to start a 6 day vacation. Just wanted to give a heads up)

Thanks for the heads up and enjoy your vacation!
Don't be worried - IMHO this quite standalone and not urgent (it can probably resolve #8319, but I don't even now what Priority-2 means in terms of SLAs 😄 )
Happy holidays!

@Don-Vito commented on GitHub (Nov 23, 2020): > > > (I want to get back to this before the EOD but I'm also worried I might not, and I'm about to start a 6 day vacation. Just wanted to give a heads up) Thanks for the heads up and enjoy your vacation! Don't be worried - IMHO this quite standalone and not urgent (it can probably resolve #8319, but I don't even now what Priority-2 means in terms of SLAs 😄 ) Happy holidays!
Author
Owner

@ghost commented on GitHub (Jan 28, 2021):

:tada:This issue was addressed in #8377, which has now been successfully released as Windows Terminal Preview v1.6.10272.0.🎉

Handy links:

@ghost commented on GitHub (Jan 28, 2021): :tada:This issue was addressed in #8377, which has now been successfully released as `Windows Terminal Preview v1.6.10272.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10272.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11524