Skip to content

Commit

Permalink
fix(PhoneNumberEditor): Apply minor accessibility fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Feb 17, 2023
1 parent 4f40d35 commit c6aee87
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions lib/components/user/phone-number-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
Label as BsLabel,
Button,
ControlLabel,
FormControl,
FormGroup,
HelpBlock,
Label
HelpBlock
} from 'react-bootstrap'
import { Field, FormikErrors } from 'formik'
import {
Expand All @@ -19,7 +19,6 @@ import React, { Component, Fragment } from 'react'
import styled, { css } from 'styled-components'

import { getErrorStates, isBlank } from '../../util/ui'
import SpanWithSpace from '../util/span-with-space'

interface Fields {
validationCode: string
Expand Down Expand Up @@ -227,6 +226,7 @@ class PhoneNumberEditor extends Component<Props, State> {
</ControlLabel>
<ControlStrip>
<InlinePhoneInput
aria-invalid={showPhoneError}
className="form-control"
country={phoneFormatOptions.countryCode}
onChange={this._handleNewPhoneNumberChange}
Expand All @@ -252,11 +252,11 @@ class PhoneNumberEditor extends Component<Props, State> {
</Button>
)
}
{showPhoneError && (
<HelpBlock>
<HelpBlock role="status">
{showPhoneError && (
<FormattedMessage id="components.PhoneNumberEditor.invalidPhone" />
</HelpBlock>
)}
)}
</HelpBlock>
</ControlStrip>
</FormGroup>
) : (
Expand All @@ -266,21 +266,17 @@ class PhoneNumberEditor extends Component<Props, State> {
</ControlLabel>
<ControlStrip>
<InlineStatic>
<SpanWithSpace margin={0.5}>
{formatPhoneNumber(
isSubmitted ? newPhoneNumber : initialPhoneNumber
)}
</SpanWithSpace>
{formatPhoneNumber(
isSubmitted ? newPhoneNumber : initialPhoneNumber
)}{' '}
{isPending ? (
// eslint-disable-next-line jsx-a11y/label-has-for
<Label bsStyle="warning">
<BsLabel bsStyle="warning">
<FormattedMessage id="components.PhoneNumberEditor.pending" />
</Label>
</BsLabel>
) : (
// eslint-disable-next-line jsx-a11y/label-has-for
<Label bsStyle="success">
<BsLabel bsStyle="success">
<FormattedMessage id="components.PhoneNumberEditor.verified" />
</Label>
</BsLabel>
)}
</InlineStatic>
<Button onClick={this._handleEditNumber}>
Expand Down

0 comments on commit c6aee87

Please sign in to comment.