From 6705a8b478790b467f0b537db73ffa2a08a8cdf5 Mon Sep 17 00:00:00 2001 From: r-zakarya <82443831+r-zakarya@users.noreply.github.com> Date: Sat, 1 Aug 2026 11:06:59 +0100 Subject: [PATCH] fix(entries): toggle the secret flag in place instead of rebuilding every row rerender() wipes the whole custom-fields list, which reads as the panel flashing and also drops focus and the auto-sized height of a multiline field. --- js/app.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index 6e135ae..3ea3c1b 100644 --- a/js/app.js +++ b/js/app.js @@ -4290,8 +4290,22 @@ function buildCustomFieldRow(field, idx, rerender) { secretBtn.addEventListener('click', ev => { ev.stopPropagation(); field.is_secret = !field.is_secret; + // Update this row in place. rerender() rebuilds every row from scratch + // (list.innerHTML = ''), which the user sees as the panel flashing — + // and it would drop the focus and the auto-sized height too. + secretBtn.classList.toggle('is-on', field.is_secret); + secretBtn.textContent = field.is_secret ? '🔒' : '👁'; + secretBtn.title = field.is_secret + ? 'Stored as secret — masked every time it is opened. Click to make it public.' + : 'Public field — shown in clear. Click to store it as a secret.'; + if (field.multiline) + valueInput.classList.toggle('is-masked', field.is_secret); + else if (valueInput.tagName === 'INPUT') + valueInput.type = field.is_secret ? 'password' : 'text'; + eye.style.visibility = + (!field.is_secret || (valueInput.tagName !== 'INPUT' && !field.multiline)) + ? 'hidden' : ''; soDirtyCheck(); - rerender(); }); const copyBtn = el('button', { class: 'icon-btn icon-btn-sm', type: 'button',