Skip to content

Commit 320522c

Browse files
author
Lucas
authored
fix: add button type and on submit handler (#1041)
1 parent d7bff3e commit 320522c

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

packages/core/src/ui/components/Account/EnableAccountPasswordPrompt/EnableAccountPasswordPrompt.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export const EnableAccountPasswordPrompt = ({
7878
label={translations.passwordPlaceholder}
7979
data-testid="enable-account-password-input"
8080
onChange={(e) => setCurrentPassword(e.target.value)}
81+
onSubmit={(event): void => {
82+
event.preventDefault();
83+
onConfirm(Buffer.from(currentPassword));
84+
}}
8185
errorMessage={wasPasswordIncorrect ? translations.wrongPassword : undefined}
8286
rootStyle={{ width: '100%' }}
8387
/>

packages/ui/src/design-system/password-box/password-box-button.component.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ export const PasswordInputButton = ({
1818
isPasswordVisible,
1919
}: Readonly<PasswordBoxButtonProps>): JSX.Element => {
2020
return (
21-
<button className={cx.inputButton} onClick={onClick} disabled={disabled}>
21+
<button
22+
type="button"
23+
className={cx.inputButton}
24+
onClick={onClick}
25+
disabled={disabled}
26+
>
2227
{isPasswordVisible ? (
2328
<CloseEye
2429
className={cn(cx.inputButtonIcon, {

packages/ui/src/design-system/password-box/password-box.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ import type { PasswordInputProps } from './password-box-input.component';
88

99
export interface PasswordBoxProps extends PasswordInputProps {
1010
rootStyle?: React.CSSProperties;
11+
onSubmit: (event: Readonly<React.FormEvent>) => void;
1112
}
1213

1314
export const PasswordBox = ({
1415
rootStyle,
16+
onSubmit,
1517
...props
1618
}: Readonly<PasswordBoxProps>): JSX.Element => {
1719
return (
18-
<Form.Root style={rootStyle}>
20+
<Form.Root style={rootStyle} onSubmit={onSubmit}>
1921
<PasswordInput {...props} />
2022
</Form.Root>
2123
);

0 commit comments

Comments
 (0)