public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar
Date: Fri, 27 Jan 2023 11:14:36 +0100	[thread overview]
Message-ID: <20230127101436.2200018-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20230127101436.2200018-1-d.csapak@proxmox.com>

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





  parent reply	other threads:[~2023-01-27 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Dominik Csapak [this message]
2023-01-31 17:02   ` [pve-devel] applied: [PATCH manager 1/1] ui: ComboBoxSetStoreNode: don't hide the picker when clicking the toolbar Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230127101436.2200018-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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