From d8a7f3fa7aa9e0a5b7ff146e9e4ff607f4d0d122 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 26 Sep 2024 14:07:40 +0200 Subject: [PATCH 1/2] cool#9992 doc sign: fix missing enable on the cert chooser description entry Open the signatures dialog, add a signature, the certificate chooser sub-dialog appears. Select a certificate, that enables e.g. the sign button, but not the description input field for some reason. Checking the websocket incoming traffic, the message for the working button and the broken entry is the same: jsdialog: { "jsontype": "dialog", "action": "action", "id": 10, "data": { "control_id": "viewcert", "action_type": "enable"}} jsdialog: { "jsontype": "dialog", "action": "action", "id": 10, "data": { "control_id": "description", "action_type": "enable"}} But the DOM is different:
Fix the problem similar to what commit 0d4e4af2cf174aba3435e44cf76aa5aa834ebb20 (jsdialog: find real input on setText action, 2022-08-24) did for the setText action type: if there is a child input element, work with that instead. Probably doing so for the disable case would also make sense, but I this dialog never disables input fields, so leave that alone for now. Signed-off-by: Miklos Vajna Change-Id: I94a9a3c5fd846be86a5db175ce93ffff136881de --- browser/src/control/Control.JSDialogBuilder.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/browser/src/control/Control.JSDialogBuilder.js b/browser/src/control/Control.JSDialogBuilder.js index 0aee28078c9e..dbfac903d34b 100644 --- a/browser/src/control/Control.JSDialogBuilder.js +++ b/browser/src/control/Control.JSDialogBuilder.js @@ -2975,6 +2975,12 @@ L.Control.JSDialogBuilder = L.Control.extend({ break; case 'enable': + // E.g. GtkEntry is represented as an inside a
, the disabled + // attribute is on the , not the
. + var innerInput = control.querySelector('input'); + if (innerInput) + control = innerInput; + control.disabled = false; control.removeAttribute('disabled'); break; From 6a4252c430c6450afd60bbba6d9b015665360544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Fri, 27 Sep 2024 08:41:20 +0200 Subject: [PATCH 2/2] jsdialog: fix input field enable action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so JSDialog.SynchronizeDisabledState will work correctly this is followup for commit 3591fba03ed6daf81c0ef588c273a4205c108e32 Fix state update of input element Signed-off-by: Szymon Kłos Change-Id: Idba598a67454933f7192039e55cc592270a5e63d --- browser/src/control/Control.JSDialogBuilder.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/browser/src/control/Control.JSDialogBuilder.js b/browser/src/control/Control.JSDialogBuilder.js index dbfac903d34b..aa42d20571b3 100644 --- a/browser/src/control/Control.JSDialogBuilder.js +++ b/browser/src/control/Control.JSDialogBuilder.js @@ -1514,7 +1514,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ edit.type = 'password'; if (data.enabled === 'false' || data.enabled === false) - $(edit).prop('disabled', true); + edit.disabled = true; JSDialog.SynchronizeDisabledState(container, [edit]); @@ -2975,12 +2975,6 @@ L.Control.JSDialogBuilder = L.Control.extend({ break; case 'enable': - // E.g. GtkEntry is represented as an inside a
, the disabled - // attribute is on the , not the
. - var innerInput = control.querySelector('input'); - if (innerInput) - control = innerInput; - control.disabled = false; control.removeAttribute('disabled'); break;