public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit] fix: gui: up/down arrow keys increment/decrement twice in Number field
Date: Thu,  7 Jul 2022 15:41:32 +0200	[thread overview]
Message-ID: <20220707134132.391584-1-d.tschlatscher@proxmox.com> (raw)

When the up or down arrow key on the keyboard was pressed while a
number text field (or any one descending from Ext.form.field.Spinner)
was selected, the up and down callbacks for that text fields KeyNav
were called twice. Therefore, the value in the text field would always
incorrectly increment/decrement by step * 2.

The problem was an overwrite for the onRender() method of the Spinner
class, which caused the callbacks for pressing an arrow key to be
registered for a second time. Simply not doing that in the overwritten
onRender() method fixes the problem.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
---
 src/Toolkit.js | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index a1d291e..0ce5185 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -469,21 +469,6 @@ Ext.define('Proxmox.form.field.Spinner', {
 
 	me.callParent();
 
-	// Init up/down arrow keys
-	if (me.keyNavEnabled) {
-	    me.spinnerKeyNav = new Ext.util.KeyNav({
-		target: me.inputEl,
-		scope: me,
-		up: me.spinUp,
-		down: me.spinDown,
-	    });
-
-	    me.inputEl.on({
-		keyup: me.onInputElKeyUp,
-		scope: me,
-	    });
-	}
-
 	// Init mouse wheel
 	if (me.mouseWheelEnabled) {
 	    me.mon(me.bodyEl, 'wheel', me.onMouseWheel, me);
-- 
2.30.2





             reply	other threads:[~2022-07-07 13:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 13:41 Daniel Tschlatscher [this message]
2022-07-13  9:49 ` Dominik Csapak

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=20220707134132.391584-1-d.tschlatscher@proxmox.com \
    --to=d.tschlatscher@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