Update PasswordInput.svelte

This commit is contained in:
carsonmccue 2023-02-19 11:25:06 -08:00
commit 36e1d0e672

View file

@ -89,6 +89,7 @@
const ctx = getContext("Form"); const ctx = getContext("Form");
$: isFluid = !!ctx && ctx.isFluid; $: isFluid = !!ctx && ctx.isFluid;
$: helperId = `helper-${id}`;
$: errorId = `error-${id}`; $: errorId = `error-${id}`;
$: warnId = `warn-${id}`; $: warnId = `warn-${id}`;
</script> </script>
@ -122,6 +123,7 @@
</label> </label>
{#if !isFluid && helperText} {#if !isFluid && helperText}
<div <div
id="{helperId}"
class:bx--form__helper-text="{true}" class:bx--form__helper-text="{true}"
class:bx--form__helper-text--disabled="{disabled}" class:bx--form__helper-text--disabled="{disabled}"
class:bx--form__helper-text--inline="{inline}" class:bx--form__helper-text--inline="{inline}"
@ -167,7 +169,13 @@
bind:this="{ref}" bind:this="{ref}"
data-invalid="{invalid || undefined}" data-invalid="{invalid || undefined}"
aria-invalid="{invalid || undefined}" aria-invalid="{invalid || undefined}"
aria-describedby="{invalid ? errorId : warn ? warnId : undefined}" aria-describedby="{invalid
? errorId
: warn
? warnId
: helperText
? helperId
: undefined}"
id="{id}" id="{id}"
name="{name}" name="{name}"
placeholder="{placeholder}" placeholder="{placeholder}"