mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(textinput/passwordinput): apply aria-describedby to hint text
* Aria-describedby Resolves base aria-describedby attribute from #1633. * Update PasswordInput.svelte
This commit is contained in:
parent
eaa4af14d1
commit
b435be4f12
2 changed files with 18 additions and 2 deletions
|
@ -89,6 +89,7 @@
|
|||
const ctx = getContext("Form");
|
||||
|
||||
$: isFluid = !!ctx && ctx.isFluid;
|
||||
$: helperId = `helper-${id}`;
|
||||
$: errorId = `error-${id}`;
|
||||
$: warnId = `warn-${id}`;
|
||||
</script>
|
||||
|
@ -122,6 +123,7 @@
|
|||
</label>
|
||||
{#if !isFluid && helperText}
|
||||
<div
|
||||
id="{helperId}"
|
||||
class:bx--form__helper-text="{true}"
|
||||
class:bx--form__helper-text--disabled="{disabled}"
|
||||
class:bx--form__helper-text--inline="{inline}"
|
||||
|
@ -167,7 +169,13 @@
|
|||
bind:this="{ref}"
|
||||
data-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}"
|
||||
name="{name}"
|
||||
placeholder="{placeholder}"
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
};
|
||||
|
||||
$: isFluid = !!ctx && ctx.isFluid;
|
||||
$: helperId = `helper-${id}`;
|
||||
$: errorId = `error-${id}`;
|
||||
$: warnId = `warn-${id}`;
|
||||
</script>
|
||||
|
@ -182,7 +183,13 @@
|
|||
data-invalid="{invalid || undefined}"
|
||||
aria-invalid="{invalid || undefined}"
|
||||
data-warn="{warn || undefined}"
|
||||
aria-describedby="{invalid ? errorId : warn ? warnId : undefined}"
|
||||
aria-describedby="{invalid
|
||||
? errorId
|
||||
: warn
|
||||
? warnId
|
||||
: helperText
|
||||
? helperId
|
||||
: undefined}"
|
||||
disabled="{disabled}"
|
||||
id="{id}"
|
||||
name="{name}"
|
||||
|
@ -219,6 +226,7 @@
|
|||
</div>
|
||||
{#if !invalid && !warn && !isFluid && !inline && helperText}
|
||||
<div
|
||||
id="{helperId}"
|
||||
class:bx--form__helper-text="{true}"
|
||||
class:bx--form__helper-text--disabled="{disabled}"
|
||||
class:bx--form__helper-text--inline="{inline}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue