Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TextInput): link helper text to input in default state #9873

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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