Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix read-only tab dialog to cancel tab closing when dismissed #9573

Merged
1 commit merged into from
Mar 22, 2021

Conversation

Don-Vito
Copy link
Contributor

Currently dismissing "are you sure you wish to close read-only tab or pane"
dialog by pressing ESC will not abort tab closing
(aka the tab will be closed!)

The reason for this, is that we cancel, only if the "Cancel" is pressed
(aka result=PrimaryButton, while ESC returns result=None).

This PR fixes this, by doing what we usually do:

  • Putting Cancel in the CloseButton (which is also triggered by ESC)
  • Aborting the action if the result is not a Primary Button

However, since we want Cancel to be a default action,
we set CloseButton to be the DefaultButton in XAML

@Don-Vito
Copy link
Contributor Author

@zadjii-msft - I think this one worth pushing into 1.7

@Don-Vito Don-Vito changed the title Fix read-only pane dialog to cancel tab closing when dismissed Fix read-only tab dialog to cancel tab closing when dismissed Mar 21, 2021
@DHowett DHowett added the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Mar 22, 2021
Comment on lines 420 to 425
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Close anyway</value>
<value>Cancel</value>
</data>
<data name="CloseReadOnlyDialog.PrimaryButtonText" xml:space="preserve">
<value>Cancel</value>
<value>Close anyway</value>
</data>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was going to be one of the cases where we have to rename the whole dialog. We do not.

If the read-only dialog was in stable (1.6), and I was not backporting the fix, I would ask you to change the CloseReadOnlyDialog name. Here's why:

When the localization build phase runs, it downloads the latest available strings -- WITH NO REGARD FOR VERSION. So, if we change the meaning of an existing string in the preview build (especially to a backwards meaning like this one!), the next stable build will receive the new meaning for all of the translations. . . except for english. The english strings follow the code in the branch, where the translated strings follow the code in main (!)

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is 100% the correct solution. We've got to be careful about these dialogs!

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 22, 2021
@ghost
Copy link

ghost commented Mar 22, 2021

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 107 seconds. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 9bd097f into microsoft:main Mar 22, 2021
@DHowett DHowett removed the zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. label Apr 2, 2021
DHowett pushed a commit that referenced this pull request Apr 2, 2021
Currently dismissing "are you sure you wish to close read-only tab or pane"
dialog by pressing `ESC` will not abort tab closing
(aka the tab will be closed!)

The reason for this, is that we cancel, only if the "Cancel" is pressed
(aka result=PrimaryButton, while ESC returns result=None).

This PR fixes this, by doing what we usually do:
* Putting Cancel in the CloseButton (which is also triggered by ESC)
* Aborting the action if the result is not a Primary Button

However, since we want Cancel to be a default action,
we set CloseButton to be the DefaultButton  in XAML

(cherry picked from commit 9bd097f)
@ghost
Copy link

ghost commented Apr 14, 2021

🎉Windows Terminal v1.7.1033.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Apr 14, 2021

🎉Windows Terminal Preview v1.8.1032.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants