Skip to content

Commit

Permalink
Complexity?
Browse files Browse the repository at this point in the history
  • Loading branch information
ychoi1 committed Apr 18, 2019
1 parent 2a89ac4 commit 7f346ec
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/Forms/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,13 @@ class TextField extends React.Component {

const inputId = id
const showHintText = hintText && !hasValue && isFocused
let describedIds = hasError ? `error_${inputId}` : ''
describedIds += hintText ? ` hint_${inputId}` : ''
let describedByIds = ''
if (hasError) {
describedByIds += `error_${inputId}`
}
if (hintText) {
describedByIds += ` hint_${inputId}`
}

return (
<div
Expand Down Expand Up @@ -261,7 +266,7 @@ class TextField extends React.Component {
type={type}
aria-required={required}
aria-invalid={hasError}
aria-describedby={describedIds ? describedIds.trim() : null}
aria-describedby={describedByIds ? describedByIds.trim() : null}
style={[
styles.input,
inputStyle,
Expand Down

0 comments on commit 7f346ec

Please sign in to comment.