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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 17 12:58:18 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>
---

changes v1 -> v2:
* keep the 
   > Ext.MessageBox.defaultButton = me.dangerous ? 2 : 1;
  line, it wasn't intended for focusing and has still its place.

The rest of this series stayed the same an can be applied as is.

 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