Skip to content

Commit

Permalink
fix(wallet): autofocus first field in forms (#2898)
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans authored Mar 7, 2025
1 parent 05168d0 commit 2822382
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/warm-weeks-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kadena/dev-wallet': patch
---

autofocus the first field of forms
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export function AddTokenForm({
<Heading variant={'h5'}>Add New Token</Heading>
<Stack width="100%" flexDirection="column" gap="md">
<TextField
autoFocus
label="SmartContract"
{...register('contract', { required: true })}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const UnlockPrompt: React.FC<{
</Text>
{showPassword && (
<TextField
autoFocus
data-testid="passwordField"
type="password"
{...register('password')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export function CreateProfile() {
<TextField
id="profileName"
type="text"
autoFocus
defaultValue={field.value}
value={field.value}
onChange={field.onChange}
Expand Down Expand Up @@ -292,6 +293,7 @@ export function CreateProfile() {
id="password"
type="password"
label="Password"
autoFocus
defaultValue={getValues('password')}
// react-hook-form uses uncontrolled elements;
// and because we add and remove the fields we need to add key to prevent confusion for react
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export function NetworkForm({
<RightAsideContent>
<Stack width="100%" flexDirection="column" gap="md">
<TextField
autoFocus={!network.uuid}
label="Network ID"
aria-label="networkId"
type="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export function ChangePassword() {
id="password"
type="password"
label="Password"
autoFocus
defaultValue={getValues('password')}
// react-hook-form uses uncontrolled elements;
// and because we add and remove the fields we need to add key to prevent confusion for react
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function ProfileNameColorForm({ isOpen }: { isOpen: boolean }) {
<RightAsideContent>
<Stack width="100%" flexDirection="column" gap="md">
<TextField
autoFocus
label="Profile Name"
placeholder="Enter profile name"
defaultValue={profile?.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export function SignatureBuilder() {
<Stack flexDirection={'column'} gap={'md'} width="100%">
<Heading as="h4">Paste SigData, CommandSigData, or Payload</Heading>
<textarea
autoFocus
value={input}
className={classNames(codeArea)}
onChange={(e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function UnlockProfile({ origin }: { origin: string }) {
<div className={passwordContainer}>
<TextField
id="password"
autoFocus
type="password"
placeholder="Password"
aria-label="Password"
Expand Down

0 comments on commit 2822382

Please sign in to comment.