Skip to content

Commit

Permalink
fix: removed accessibility integration due to we have a couple of gra…
Browse files Browse the repository at this point in the history
…y areas on it, will be on stand by
  • Loading branch information
blakmetall committed May 12, 2020
1 parent a00572d commit 3520c69
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 26 deletions.
6 changes: 1 addition & 5 deletions src/components/CodeInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import StyledTextError from '../Input/styled/errorText';
import { useReduxForm, useUniqueIdentifier } from '../../libs/hooks';
import { useFocusedIndexState, usePreviousIndex, useValueState } from './hooks';
import { getNormalizedValue, getNumbersFromClipboard, setFocus } from './helpers';
import { StyledFieldset, StyledHiddenLabel, StyledLabel } from './styled';
import { StyledFieldset, StyledLabel } from './styled';

/**
* The CodeInput is an element that allows to fill a list of numbers, suitable for code validations.
Expand Down Expand Up @@ -41,7 +41,6 @@ const CodeInput = React.forwardRef((props, ref) => {
const focusedIndex = useFocusedIndexState(value, length);
const previousFocusedIndex = usePreviousIndex(focusedIndex);
const inputId = useUniqueIdentifier('code-input');
const labelId = useUniqueIdentifier('code-input-label');

useImperativeHandle(ref, () => ({
focus: () => {
Expand Down Expand Up @@ -83,8 +82,6 @@ const CodeInput = React.forwardRef((props, ref) => {
<RequiredAsterisk required={required} />
{label}
</StyledLabel>

<StyledHiddenLabel id={labelId}>{label}</StyledHiddenLabel>
</RenderIf>

<InputItems
Expand All @@ -102,7 +99,6 @@ const CodeInput = React.forwardRef((props, ref) => {
id={inputId}
focusedIndex={focusedIndex}
ref={inputRef}
labelId={labelId}
/>
<RenderIf isTrue={!!bottomHelpText}>
<HelpText>{bottomHelpText}</HelpText>
Expand Down
5 changes: 0 additions & 5 deletions src/components/CodeInput/inputItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const InputItem = React.forwardRef((props, ref) => {
onPaste,
id,
isActive,
ariaLabelledBy,
} = props;

const handleOnKeyDown = (e, inputIndex) => {
Expand Down Expand Up @@ -51,8 +50,6 @@ const InputItem = React.forwardRef((props, ref) => {
maxLength="1"
id={id}
isActive={isActive}
aria-label="Enter a number"
aria-labelledby={ariaLabelledBy}
/>
);
});
Expand All @@ -72,7 +69,6 @@ InputItem.propTypes = {
onKeyDown: PropTypes.func,
onPaste: PropTypes.func,
isActive: PropTypes.bool,
ariaLabelledBy: PropTypes.string,
};

InputItem.defaultProps = {
Expand All @@ -90,7 +86,6 @@ InputItem.defaultProps = {
onKeyDown: () => {},
onPaste: () => {},
isActive: false,
ariaLabelledBy: null,
};

export default InputItem;
5 changes: 0 additions & 5 deletions src/components/CodeInput/inputItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const InputItems = React.forwardRef((props, ref) => {
onPaste,
focusedIndex,
id,
labelId,
} = props;

const inputs = value.map((inputValue, index) => {
Expand All @@ -27,7 +26,6 @@ const InputItems = React.forwardRef((props, ref) => {
const inputRef = isActive ? ref : null;
const inputId = isActive ? id : `${id}-${index}`;
const inputTabIndex = isActive ? tabIndex : -1;
const ariaLabelledBy = isActive ? labelId : null;

return (
<InputItem
Expand All @@ -48,7 +46,6 @@ const InputItems = React.forwardRef((props, ref) => {
ref={inputRef}
id={inputId}
isActive={isActive}
ariaLabelledBy={ariaLabelledBy}
/>
);
});
Expand All @@ -71,7 +68,6 @@ InputItems.propTypes = {
onPaste: PropTypes.func,
focusedIndex: PropTypes.number,
id: PropTypes.string,
labelId: PropTypes.string,
};

InputItems.defaultProps = {
Expand All @@ -89,7 +85,6 @@ InputItems.defaultProps = {
onPaste: () => {},
focusedIndex: undefined,
id: undefined,
labelId: undefined,
};

export default InputItems;
12 changes: 1 addition & 11 deletions src/components/CodeInput/styled/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@ const StyledFieldset = styled.fieldset`
text-align: center;
`;

const StyledHiddenLabel = styled.label`
display: block;
width: 0;
height: 0;
overflow: hidden;
border: 0;
border-color: transparent;
margin: 0;
`;

const StyledLabel = attachThemeAttrs(styled.legend)`
border: 0;
padding: 0;
Expand All @@ -123,4 +113,4 @@ const StyledLabel = attachThemeAttrs(styled.legend)`
}
`;

export { StyledInput, StyledFieldset, StyledHiddenLabel, StyledLabel };
export { StyledInput, StyledFieldset, StyledLabel };

0 comments on commit 3520c69

Please sign in to comment.