diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-12-05 07:02:11 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-12-05 07:02:11 +0100 |
| commit | b12d61a1c6d5f793400ae9ae6f4641c3f3c144b0 (patch) | |
| tree | 4519354d9b94363c43692e5c8db52e4719468a42 /code/app/src/lib/components/input.svelte | |
| parent | d49ba8bca4475082679631b2e613ad288abd8cbb (diff) | |
| download | greatoffice-b12d61a1c6d5f793400ae9ae6f4641c3f3c144b0.tar.xz greatoffice-b12d61a1c6d5f793400ae9ae6f4641c3f3c144b0.zip | |
feat: Support errors, add aria when errors or errorText
Diffstat (limited to 'code/app/src/lib/components/input.svelte')
| -rw-r--r-- | code/app/src/lib/components/input.svelte | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/code/app/src/lib/components/input.svelte b/code/app/src/lib/components/input.svelte index ac01348..80b1543 100644 --- a/code/app/src/lib/components/input.svelte +++ b/code/app/src/lib/components/input.svelte @@ -1,6 +1,7 @@ <script lang="ts"> import pwKey from "$actions/pwKey"; import { random_string } from "$lib/helpers"; + import { error } from "@sveltejs/kit"; import { ExclamationCircleIcon } from "./icons"; export let label: string | undefined = undefined; @@ -24,8 +25,8 @@ $: ariaErrorDescribedBy = id + "__" + "error"; $: attributes = { - "aria-describedby": errorText ? ariaErrorDescribedBy : null, - "aria-invalid": errorText ? "true" : null, + "aria-describedby": errorText || errors?.length ? ariaErrorDescribedBy : null, + "aria-invalid": errorText || errors?.length ? "true" : null, disabled: disabled || null, autocomplete: autocomplete || null, required: required || null, |
