Repository: nvaccess/nvda

Issue:
Cannot "escape" out of the "Confirm Deletion" prompt when the Deleting Configuration button is pressed
In NVDA's Configuration profiles dialog, select a profile, and press alt+d or activate the "delete" button.

The "Confirm deletion" prompt appears.  Options are Yes or No.

Pressing escape should select no and close the dialog without deleting, however it does nothing.  There is no need for a "cancel" button as "No" performs the same function.

Not high priority, however potentially opens up possibility of inadvertently deleting a configuration profile if someone accidentally opens the delete prompt and thinks they have dismissed it with escape.
Cannot "escape" out of the "Confirm Deletion" prompt when the Deleting Configuration button is pressed
In NVDA's Configuration profiles dialog, select a profile, and press alt+d or activate the "delete" button.

The "Confirm deletion" prompt appears.  Options are Yes or No.

Pressing escape should select no and close the dialog without deleting, however it does nothing.  There is no need for a "cancel" button as "No" performs the same function.

Not high priority, however potentially opens up possibility of inadvertently deleting a configuration profile if someone accidentally opens the delete prompt and thinks they have dismissed it with escape.


Discussion:
Hi,

Confirmed.

Technical: gui.messageBox flags might be the culprit here.

Thanks.
Looks like this is because we are using `wx.YES | wx.NO` flags with the message box.
The [wx docs for messageBox](http://docs.wxwidgets.org/3.1.0/classwx_message_dialog.html) specifies:

>  It is recommended to always use wxCANCEL with this style as otherwise the message box won't have a close button under wxMSW and the user will be forced to answer it.

Adding wx.CANCEL allows the dialog to be dismissed with the `esc` key
I can understand why we have the buttons we do - it IS a yes / no question
- and there is no difference between saying "no" and pressing a "cancel"
button.  I don't think adding a cancel button would add confusion if there
isn't an easy way to simply catch someone pressing the escape key and
activate the no button if they do?


--
22 Point

Check out our first app, RapiTap! - Tap targets fast & avoid decoys:
Adrenaline pumping, Challenging, Accessible!
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitap
Free trial:
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitapfree

Web: http://www.22point.com.au
Facebook: https://www.facebook.com/22Point
Twitter: https://twitter.com/22PointApps

On 13 February 2017 at 19:48, Reef Turner <notifications@github.com> wrote:

> Looks like this is because we are using wx.YES | wx.NO flags with the
> message box.
> The wx docs for messageBox
> <http://docs.wxwidgets.org/3.1.0/classwx_message_dialog.html> specifies:
>
> It is recommended to always use wxCANCEL with this style as otherwise the
> message box won't have a close button under wxMSW and the user will be
> forced to answer it.
>
> Adding wx.CANCEL allows the dialog to be dismissed with the esc key
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/nvaccess/nvda/issues/6851#issuecomment-279326197>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/APKmCFZYoWeLEEBesGpvXOBWbY_g4dkRks5rcBjMgaJpZM4L6Uvm>
> .
>

Adding `wx.CANCEL` results in three buttons (yes, no, and cancel). Rather than do that I have re-worded the sentence, swapped to use the ok/cancel buttons. The message box will now say: 
>This profile will be permanently deleted, this action cannot be undone.
That's probably a better solution, good job.


--
22 Point

Check out our first app, RapiTap! - Tap targets fast & avoid decoys:
Adrenaline pumping, Challenging, Accessible!
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitap
Free trial:
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitapfree

Web: http://www.22point.com.au
Facebook: https://www.facebook.com/22Point
Twitter: https://twitter.com/22PointApps

On 13 February 2017 at 20:40, Reef Turner <notifications@github.com> wrote:

> Adding wx.CANCEL results in three buttons (yes, no, and cancel). Rather
> than do that I have re-worded the sentence, swapped to use the ok/cancel
> buttons. The message box will now say:
>
> This profile will be permanently deleted, this action cannot be undone.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/nvaccess/nvda/issues/6851#issuecomment-279337228>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/APKmCMBCwItO92iF3BhNQ2tchYFvNzU0ks5rcCTwgaJpZM4L6Uvm>
> .
>

Hi,

Confirmed.

Technical: gui.messageBox flags might be the culprit here.

Thanks.
Looks like this is because we are using `wx.YES | wx.NO` flags with the message box.
The [wx docs for messageBox](http://docs.wxwidgets.org/3.1.0/classwx_message_dialog.html) specifies:

>  It is recommended to always use wxCANCEL with this style as otherwise the message box won't have a close button under wxMSW and the user will be forced to answer it.

Adding wx.CANCEL allows the dialog to be dismissed with the `esc` key
I can understand why we have the buttons we do - it IS a yes / no question
- and there is no difference between saying "no" and pressing a "cancel"
button.  I don't think adding a cancel button would add confusion if there
isn't an easy way to simply catch someone pressing the escape key and
activate the no button if they do?


--
22 Point

Check out our first app, RapiTap! - Tap targets fast & avoid decoys:
Adrenaline pumping, Challenging, Accessible!
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitap
Free trial:
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitapfree

Web: http://www.22point.com.au
Facebook: https://www.facebook.com/22Point
Twitter: https://twitter.com/22PointApps

On 13 February 2017 at 19:48, Reef Turner <notifications@github.com> wrote:

> Looks like this is because we are using wx.YES | wx.NO flags with the
> message box.
> The wx docs for messageBox
> <http://docs.wxwidgets.org/3.1.0/classwx_message_dialog.html> specifies:
>
> It is recommended to always use wxCANCEL with this style as otherwise the
> message box won't have a close button under wxMSW and the user will be
> forced to answer it.
>
> Adding wx.CANCEL allows the dialog to be dismissed with the esc key
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/nvaccess/nvda/issues/6851#issuecomment-279326197>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/APKmCFZYoWeLEEBesGpvXOBWbY_g4dkRks5rcBjMgaJpZM4L6Uvm>
> .
>

Adding `wx.CANCEL` results in three buttons (yes, no, and cancel). Rather than do that I have re-worded the sentence, swapped to use the ok/cancel buttons. The message box will now say: 
>This profile will be permanently deleted, this action cannot be undone.
That's probably a better solution, good job.


--
22 Point

Check out our first app, RapiTap! - Tap targets fast & avoid decoys:
Adrenaline pumping, Challenging, Accessible!
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitap
Free trial:
https://play.google.com/store/apps/details?id=au.com.twentytwopoint.rapitapfree

Web: http://www.22point.com.au
Facebook: https://www.facebook.com/22Point
Twitter: https://twitter.com/22PointApps

On 13 February 2017 at 20:40, Reef Turner <notifications@github.com> wrote:

> Adding wx.CANCEL results in three buttons (yes, no, and cancel). Rather
> than do that I have re-worded the sentence, swapped to use the ok/cancel
> buttons. The message box will now say:
>
> This profile will be permanently deleted, this action cannot be undone.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/nvaccess/nvda/issues/6851#issuecomment-279337228>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/APKmCMBCwItO92iF3BhNQ2tchYFvNzU0ks5rcCTwgaJpZM4L6Uvm>
> .
>


Resolving patch:
diff --git a/source/gui/configProfiles.py b/source/gui/configProfiles.py
--- a/source/gui/configProfiles.py
+++ b/source/gui/configProfiles.py
@@ -171,11 +171,11 @@ def onDelete(self, evt):
 		index = self.profileList.Selection
 		if gui.messageBox(
 			# Translators: The confirmation prompt displayed when the user requests to delete a configuration profile.
-			_("Are you sure you want to delete this profile? This cannot be undone."),
+			_("This profile will be permanently deleted. This action cannot be undone."),
 			# Translators: The title of the confirmation dialog for deletion of a configuration profile.
 			_("Confirm Deletion"),
-			wx.YES | wx.NO | wx.ICON_QUESTION, self
-		) == wx.NO:
+			wx.OK | wx.CANCEL | wx.ICON_QUESTION, self
+		) != wx.OK:
 			return
 		name = self.profileNames[index]
 		try:


Test patch: