[pve-devel] [PATCH manager v2 1/2] explicit set button focus respecting the 'dangerous' option

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jun 6 15:40:36 CEST 2017


The line:
 > Ext.MessageBox.defaultButton = me.dangerous ? 2 : 1;
just set the button which should get triggered on an keyboard "Enter"
if no button is focused currently.

But often the 'Yes' buttons is focused so an enter press would
trigger it, even on a as 'dangerous' marked option.

Fix this, as else a to fast "Enter" press can cause more problems
than needed.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/button/Button.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/www/manager6/button/Button.js b/www/manager6/button/Button.js
index 38668997..8dccae0a 100644
--- a/www/manager6/button/Button.js
+++ b/www/manager6/button/Button.js
@@ -46,6 +46,7 @@ Ext.define('PVE.button.Button', {
 			icon: me.dangerous ? Ext.Msg.WARNING : Ext.Msg.QUESTION,
 			msg: msg,
 			buttons: Ext.Msg.YESNO,
+			defaultFocus: me.dangerous ? 'no' : 'yes',
 			callback: function(btn) {
 			    if (btn !== 'yes') {
 				return;
-- 
2.11.0





More information about the pve-devel mailing list