Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Fix react warning "Received false for a non-boolean attribute `titl…
Browse files Browse the repository at this point in the history
…e`" (#194)

If a form field doesn't have an error, we're currently setting its title to false, which triggers a react warning "Received false for a non-boolean attribute title".

Set title to undefined if the error property isn't a string.
  • Loading branch information
vishwam authored May 18, 2020
1 parent 5be4701 commit 9600bda
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 109 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 8.0.5
### Fixed
- When a FormField was rendered with no error, we were setting the FormError's title to `false`, causing a react warning.
- Updated node-sass to fix npm audit warnings.

## 8.0.4
### Changed
- Updated fields to pass in `aria-required={props.required}` to input
Expand Down
2 changes: 1 addition & 1 deletion lib/components/Field/FormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class FormField extends React.PureComponent<FormFieldProps, FormFieldStat
className={props.errorClassName}
hidden={props.hideError}
hideIcon={props.loading}
title={typeof error === 'string' && error}
title={typeof error === 'string' ? error : undefined}
ariaLabel={props.errorAriaLabel}
attr={{container: {
'aria-live': 'polite', // this tags are for screen readers to read the error when it appears
Expand Down
Loading

0 comments on commit 9600bda

Please sign in to comment.