[pve-devel] [PATCH widget-toolkit] Add focusable pseudo class to edit windows defaultFocus

Fabian Möller fabianm88 at gmail.com
Wed Jul 8 10:42:42 CEST 2020


Restricting the defaultFocus of the edit windows to only focusable fields
ensures that windows like "PVE -> Virtual Machine -> Manage HA", which
has a first field of xtype "displayfield", receive focus upon opening.

This allows those windows to be closed with the ESC key, which only
works when an element inside has focus.

In newer versions of ExtJS (>= 6.2.0) this filter could be reduced to
"field:canfocus" or maybe even ":canfocus".
---
 src/window/Edit.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/window/Edit.js b/src/window/Edit.js
index c165141..d7972b6 100644
--- a/src/window/Edit.js
+++ b/src/window/Edit.js
@@ -33,7 +33,7 @@ Ext.define('Proxmox.window.Edit', {
     defaultButton: 'submitbutton',
 
     // finds the first form field
-    defaultFocus: 'field[disabled=false][hidden=false]',
+    defaultFocus: 'field:focusable[disabled=false][hidden=false]',
 
     showProgress: false,
 
-- 
2.27.0





More information about the pve-devel mailing list