Skip to content

Commit f3b429b

Browse files
committed
add role="alert" in ErrorList
1 parent 7575fd9 commit f3b429b

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

exercises/02.authentication/02.problem.2fa/app/components/forms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function ErrorList({
2424
const errorsToRender = errors?.filter(Boolean)
2525
if (!errorsToRender?.length) return null
2626
return (
27-
<ul id={id} className="flex flex-col gap-1">
27+
<ul id={id} className="flex flex-col gap-1" role="alert">
2828
{errorsToRender.map((e) => (
2929
<li key={e} className="text-foreground-destructive text-[10px]">
3030
{e}

exercises/02.authentication/02.solution.2fa/app/components/forms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function ErrorList({
2424
const errorsToRender = errors?.filter(Boolean)
2525
if (!errorsToRender?.length) return null
2626
return (
27-
<ul id={id} className="flex flex-col gap-1">
27+
<ul id={id} className="flex flex-col gap-1" role="alert">
2828
{errorsToRender.map((e) => (
2929
<li key={e} className="text-foreground-destructive text-[10px]">
3030
{e}

exercises/02.authentication/03.problem.passkeys/app/components/forms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function ErrorList({
2424
const errorsToRender = errors?.filter(Boolean)
2525
if (!errorsToRender?.length) return null
2626
return (
27-
<ul id={id} className="flex flex-col gap-1">
27+
<ul id={id} className="flex flex-col gap-1" role="alert">
2828
{errorsToRender.map((e) => (
2929
<li key={e} className="text-foreground-destructive text-[10px]">
3030
{e}

exercises/02.authentication/03.solution.passkeys/app/components/forms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function ErrorList({
2424
const errorsToRender = errors?.filter(Boolean)
2525
if (!errorsToRender?.length) return null
2626
return (
27-
<ul id={id} className="flex flex-col gap-1">
27+
<ul id={id} className="flex flex-col gap-1" role="alert">
2828
{errorsToRender.map((e) => (
2929
<li key={e} className="text-foreground-destructive text-[10px]">
3030
{e}

exercises/02.authentication/03.solution.passkeys/tests/e2e/authentication-passkeys.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ test('displays an error when authenticating via a passkey fails', async ({
7272
await page.getByRole('button', { name: 'Login with a passkey' }).click()
7373

7474
await expect(
75-
page.getByText(
76-
'Failed to authenticate with passkey: The operation either timed out or was not allowed',
77-
),
75+
page
76+
.getByRole('alert')
77+
.getByText(
78+
'Failed to authenticate with passkey: The operation either timed out or was not allowed',
79+
),
7880
).toBeVisible()
7981
})

exercises/02.authentication/04.problem.protected-logic/app/components/forms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function ErrorList({
2424
const errorsToRender = errors?.filter(Boolean)
2525
if (!errorsToRender?.length) return null
2626
return (
27-
<ul id={id} className="flex flex-col gap-1">
27+
<ul id={id} className="flex flex-col gap-1" role="alert">
2828
{errorsToRender.map((e) => (
2929
<li key={e} className="text-foreground-destructive text-[10px]">
3030
{e}

exercises/02.authentication/04.solution.protected-logic/app/components/forms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function ErrorList({
2424
const errorsToRender = errors?.filter(Boolean)
2525
if (!errorsToRender?.length) return null
2626
return (
27-
<ul id={id} className="flex flex-col gap-1">
27+
<ul id={id} className="flex flex-col gap-1" role="alert">
2828
{errorsToRender.map((e) => (
2929
<li key={e} className="text-foreground-destructive text-[10px]">
3030
{e}

0 commit comments

Comments
 (0)