public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit/manager] fix focus/tbar selection issues in ComboGrid
@ 2023-01-27 10:14 Dominik Csapak
  2023-01-27 10:14 ` [pve-devel] [PATCH widget-toolkit 1/1] ComboGrid: avoid needing two clicks after reselecting an item Dominik Csapak
  2023-01-27 10:14 ` [pve-devel] [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar Dominik Csapak
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Csapak @ 2023-01-27 10:14 UTC (permalink / raw)
  To: pve-devel

these two patches fix two issues regarding the combobox and the
ComboBoxSetStoreNode. The widget-toolkit patch is necessary to avoid
glitches after the second patch, but independently fixes also the
behaviour described in that commit message.

proxmox-widget-toolkit:

Dominik Csapak (1):
  ComboGrid: avoid needing two clicks after reselecting an item

 src/form/ComboGrid.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

manager:

Dominik Csapak (1):
  ui: ComboBoxSetStoreNode: don't hide the picker when clicking the
    toolbar

 www/manager6/form/ComboBoxSetStoreNode.js | 30 +++++++++++++++++++++++
 1 file changed, 30 insertions(+)

-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH widget-toolkit 1/1] ComboGrid: avoid needing two clicks after reselecting an item
  2023-01-27 10:14 [pve-devel] [PATCH widget-toolkit/manager] fix focus/tbar selection issues in ComboGrid Dominik Csapak
@ 2023-01-27 10:14 ` Dominik Csapak
  2023-01-31  9:35   ` [pve-devel] applied: " Thomas Lamprecht
  2023-01-27 10:14 ` [pve-devel] [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar Dominik Csapak
  1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2023-01-27 10:14 UTC (permalink / raw)
  To: pve-devel

'picker.hide()' hides the picker, but does not do everything to properly
keep track of the picker state in the combobox class.

This lead to a bug when we reselected an entry, we had to click the
picker again twice to open it again.

Use the 'collapse' method of the combobox instead, which does the
necessary book-keeping.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/form/ComboGrid.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/form/ComboGrid.js b/src/form/ComboGrid.js
index ba3ce40..29c3d26 100644
--- a/src/form/ComboGrid.js
+++ b/src/form/ComboGrid.js
@@ -290,7 +290,7 @@ Ext.define('Proxmox.form.ComboGrid', {
 	if (!me.multiSelect) {
 	    picker.on('itemclick', function(sm, record) {
 		if (picker.getSelection()[0] === record) {
-		    picker.hide();
+		    me.collapse();
 		}
 	    });
 	}
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar
  2023-01-27 10:14 [pve-devel] [PATCH widget-toolkit/manager] fix focus/tbar selection issues in ComboGrid Dominik Csapak
  2023-01-27 10:14 ` [pve-devel] [PATCH widget-toolkit 1/1] ComboGrid: avoid needing two clicks after reselecting an item Dominik Csapak
@ 2023-01-27 10:14 ` Dominik Csapak
  2023-01-31 17:02   ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2023-01-27 10:14 UTC (permalink / raw)
  To: pve-devel

When clicking the toolbar of the ComboGrid, the combobox loses focus,
and instantly hides the picker.

To prevent that, we keep track of the mousedown event on the toolbar
(which happily comes before the focusLeave event), and prevent the
focusLeave propagation in that case.

Then on mouseup, we focus the combobox again, so that the nexct
focusLeave can trigger again.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/form/ComboBoxSetStoreNode.js | 30 +++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/www/manager6/form/ComboBoxSetStoreNode.js b/www/manager6/form/ComboBoxSetStoreNode.js
index a654636b7..a127af3a5 100644
--- a/www/manager6/form/ComboBoxSetStoreNode.js
+++ b/www/manager6/form/ComboBoxSetStoreNode.js
@@ -29,6 +29,30 @@ Ext.define('PVE.form.ComboBoxSetStoreNode', {
 	me.fireEvent('nodechanged', value);
     },
 
+    tbarMouseDown: function() {
+	this.mousePressed = true;
+    },
+
+    tbarMouseUp: function() {
+	let me = this;
+	delete this.mousePressed;
+	if (me.focusLeft) {
+	    me.focus();
+	    delete me.focusLeft;
+	}
+    },
+
+    // conditionally prevent the focusLeave handler to continue, preventing collapsing of the picker
+    onFocusLeave: function() {
+	let me = this;
+	me.focusLeft = true;
+	if (!me.mousePressed) {
+	    me.callParent(arguments);
+	}
+
+	return undefined;
+    },
+
     initComponent: function() {
 	let me = this;
 
@@ -37,6 +61,12 @@ Ext.define('PVE.form.ComboBoxSetStoreNode', {
 	    Ext.apply(me.listConfig ?? {}, {
 		tbar: {
 		    xtype: 'toolbar',
+		    listeners: {
+			mousedown: me.tbarMouseDown,
+			mouseup: me.tbarMouseUp,
+			element: 'el',
+			scope: me,
+		    },
 		    items: [
 			{
 			    xtype: "pveStorageScanNodeSelector",
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH widget-toolkit 1/1] ComboGrid: avoid needing two clicks after reselecting an item
  2023-01-27 10:14 ` [pve-devel] [PATCH widget-toolkit 1/1] ComboGrid: avoid needing two clicks after reselecting an item Dominik Csapak
@ 2023-01-31  9:35   ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2023-01-31  9:35 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 27/01/2023 um 11:14 schrieb Dominik Csapak:
> 'picker.hide()' hides the picker, but does not do everything to properly
> keep track of the picker state in the combobox class.
> 
> This lead to a bug when we reselected an entry, we had to click the
> picker again twice to open it again.
> 
> Use the 'collapse' method of the combobox instead, which does the
> necessary book-keeping.
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/form/ComboGrid.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar
  2023-01-27 10:14 ` [pve-devel] [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar Dominik Csapak
@ 2023-01-31 17:02   ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2023-01-31 17:02 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 27/01/2023 um 11:14 schrieb Dominik Csapak:
> When clicking the toolbar of the ComboGrid, the combobox loses focus,
> and instantly hides the picker.
> 
> To prevent that, we keep track of the mousedown event on the toolbar
> (which happily comes before the focusLeave event), and prevent the
> focusLeave propagation in that case.
> 
> Then on mouseup, we focus the combobox again, so that the nexct
> focusLeave can trigger again.
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  www/manager6/form/ComboBoxSetStoreNode.js | 30 +++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-31 17:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 10:14 [pve-devel] [PATCH widget-toolkit/manager] fix focus/tbar selection issues in ComboGrid Dominik Csapak
2023-01-27 10:14 ` [pve-devel] [PATCH widget-toolkit 1/1] ComboGrid: avoid needing two clicks after reselecting an item Dominik Csapak
2023-01-31  9:35   ` [pve-devel] applied: " Thomas Lamprecht
2023-01-27 10:14 ` [pve-devel] [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar Dominik Csapak
2023-01-31 17:02   ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal