]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
Add focusable pseudo class to edit windows defaultFocus
authorFabian Möller <fabianm88@gmail.com>
Wed, 8 Jul 2020 08:42:42 +0000 (10:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 9 Jul 2020 12:10:17 +0000 (14:10 +0200)
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

index c165141129f7e725d18a04a17a0b02ed8f683be8..d7972b64df0251500f3e27d876c762d14745d9c7 100644 (file)
@@ -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,