Skip to content

Commit a8ad515

Browse files
committed
ensure button is also not enabled
1 parent 8e8b4ec commit a8ad515

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

site/src/components/SettingsAccountForm/SettingsAccountForm.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ describe("AccountForm", () => {
3030
// Then
3131
const el = await screen.findByLabelText("Username")
3232
expect(el).toBeEnabled()
33+
const btn = await screen.findByRole("button")
34+
expect(btn).toBeEnabled()
3335
})
3436
})
3537

@@ -56,6 +58,8 @@ describe("AccountForm", () => {
5658
// Then
5759
const el = await screen.findByLabelText("Username")
5860
expect(el).toBeDisabled()
61+
const btn = await screen.findByRole("button")
62+
expect(btn).toBeDisabled()
5963
})
6064
})
6165
})

site/src/components/SettingsAccountForm/SettingsAccountForm.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const AccountForm: FC<React.PropsWithChildren<AccountFormProps>> = ({
6464
<TextField
6565
{...getFieldHelpers("username")}
6666
onChange={onChangeTrimmed(form)}
67+
aria-disabled={!editable}
6768
autoComplete="username"
6869
disabled={!editable}
6970
fullWidth
@@ -72,7 +73,13 @@ export const AccountForm: FC<React.PropsWithChildren<AccountFormProps>> = ({
7273
/>
7374

7475
<div>
75-
<LoadingButton loading={isLoading} type="submit" variant="contained">
76+
<LoadingButton
77+
loading={isLoading}
78+
aria-disabled={!editable}
79+
disabled={!editable}
80+
type="submit"
81+
variant="contained"
82+
>
7683
{isLoading ? "" : Language.updateSettings}
7784
</LoadingButton>
7885
</div>

0 commit comments

Comments
 (0)