Skip to content

Commit

Permalink
fix(TextInput): link helper text to input in default state (#9873)
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandra Davila <aledavila@ibm.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 5, 2021
1 parent b0a79ab commit 6656a63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react/src/components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const TextInput = React.forwardRef(function TextInput(
title: placeholder,
disabled: normalizedProps.disabled,
readOnly,
['aria-describedby']: normalizedProps.helperId,
...other,
};
const inputWrapperClasses = classNames(
Expand Down Expand Up @@ -134,8 +135,11 @@ const TextInput = React.forwardRef(function TextInput(
{labelText}
</label>
) : null;

const helper = helperText ? (
<div className={helperTextClasses}>{helperText}</div>
<div id={normalizedProps.helperId} className={helperTextClasses}>
{helperText}
</div>
) : null;

const input = (
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/internal/useNormalizedInputProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function useNormalizedInputProps({
warnId: `${id}-warn-msg`,
validation: null,
icon: null,
helperId: `${id}-helper-text`,
};

if (readOnly) {
Expand Down

0 comments on commit 6656a63

Please sign in to comment.