Skip to content

Commit

Permalink
chore: moved feedback error notification
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-contreras committed Dec 1, 2023
1 parent 7e4cbbe commit d09199a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/react/src/components/Field/FieldFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,20 @@ export const FieldFeedback: React.FunctionComponent<FieldFeedbackProps> = ({
}: FieldFeedbackProps) => {
const Errors = React.useMemo(() => {
if (!errors || !errors.length) return null;
return (
<ul
return errors.join(' ');
}, [errors]);

return (
<div id={id} className={className}>
<div
className={errorsClass}
id={errorsId}
aria-label="Errors"
aria-live={(liveErrors) ? 'assertive' : undefined}
aria-atomic={(liveErrors) ? 'true' : undefined}
>
{ errors.map((err) => <li key={err}>{ err }</li>) }
</ul>
);
}, [errors, errorsClass, errorsId, liveErrors]);

return (
<div id={id} className={className}>
{ Errors }
{Errors}
</div>
{ children }
</div>
);
Expand Down

0 comments on commit d09199a

Please sign in to comment.