7988534357d6

autofocus first password input and submit on Enter for peachscript and QR backup forms

time
2026-04-27 17:54 UTC · 6 months ago
machine
koh2
parent
c5d246f728d6
1 file src/popup/views/Export.tsx+26 −0
src/popup/views/Export.tsx+26 −0
@@ -169,11 +169,18 @@169169               </p>170170               <div class="peach-settings-stack peach-export-password-stack">171171                 <input172+                  ref={(el) => queueMicrotask(() => el.focus())}172173                   class="peach-settings-input"173174                   type="password"174175                   placeholder={`backup password (min ${MIN_BACKUP_PASSWORD} chars)`}175176                   value={pass()}176177                   onInput={(e) => setPass((e.target as HTMLInputElement).value)}178+                  onKeyDown={(e) => {179+                    if (e.key === "Enter" && passReady() && !working()) {180+                      e.preventDefault();181+                      void handleEncode();182+                    }183+                  }}177184                 />178185                 <input179186                   class="peach-settings-input"@@ -181,6 +188,12 @@181188                   placeholder="confirm backup password"182189                   value={confirm()}183190                   onInput={(e) => setConfirm((e.target as HTMLInputElement).value)}191+                  onKeyDown={(e) => {192+                    if (e.key === "Enter" && passReady() && !working()) {193+                      e.preventDefault();194+                      void handleEncode();195+                    }196+                  }}184197                 />185198                 <Show when={confirm().length > 0 && pass() !== confirm()}>186199                   <p class="peach-export-note" style="color:var(--peach-t2)">@@ -308,11 +321,18 @@308321               </p>309322               <div class="peach-settings-stack peach-export-password-stack">310323                 <input324+                  ref={(el) => queueMicrotask(() => el.focus())}311325                   class="peach-settings-input"312326                   type="password"313327                   placeholder={`backup password (min ${MIN_BACKUP_PASSWORD} chars)`}314328                   value={pass()}315329                   onInput={(e) => setPass((e.target as HTMLInputElement).value)}330+                  onKeyDown={(e) => {331+                    if (e.key === "Enter" && passReady() && !working()) {332+                      e.preventDefault();333+                      void handleEncode();334+                    }335+                  }}316336                 />317337                 <input318338                   class="peach-settings-input"@@ -320,6 +340,12 @@320340                   placeholder="confirm backup password"321341                   value={confirm()}322342                   onInput={(e) => setConfirm((e.target as HTMLInputElement).value)}343+                  onKeyDown={(e) => {344+                    if (e.key === "Enter" && passReady() && !working()) {345+                      e.preventDefault();346+                      void handleEncode();347+                    }348+                  }}323349                 />324350               </div>325351               <button

view file