Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
- [Button component - does not render the aria-label attribute properly](https://github.com/Capgemini/dcx-react-library/issues/618)
- [Tab - Actionable Element](https://github.com/Capgemini/dcx-react-library/issues/629)
- [FormRadio and FormInput - does not offer a capability to not add an aria-label](https://github.com/Capgemini/dcx-react-library/issues/621)
- [Checkbox - does not offer a capability to not add an aria-label](https://github.com/Capgemini/dcx-react-library/issues/650)
- [FormInput - does not offer a capability to not add an aria-label](https://github.com/Capgemini/dcx-react-library/issues/650)
- [FormInput - should not have a tabindex defined](https://github.com/Capgemini/dcx-react-library/issues/623)
- [FormInput - An aria attribute has been given an invalid value](https://github.com/Capgemini/dcx-react-library/issues/631)
- [Autocomplete - is not accessible and needs to be adjusted](https://github.com/Capgemini/dcx-react-library/issues/624)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@capgeminiuk/dcx-react-library",
"author": "Capgemini UK",
"license": "MIT",
"version": "1.0.0",
"version": "1.0.0-rc8",
"source": "src/index.ts",
"main": "dist/dcx-react-library.js",
"module": "dist/dcx-react-library.module.js",
Expand Down Expand Up @@ -136,4 +136,4 @@
"@cesium133/forgjs": "1.1.10",
"imask": "^6.4.3"
}
}
}
2 changes: 1 addition & 1 deletion src/formCheckbox/FormCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const FormCheckbox = ({
inputProps={inputProps}
itemProps={itemProps}
labelProps={labelProps}
ariaLabel={ariaLabel || name}
ariaLabel={ariaLabel}
ariaDataControls={ariaDataControls}
ariaDescribedBy={ariaDescribedBy}
ariaLabelledBy={ariaLabelledBy || labelProps?.id}
Expand Down
26 changes: 11 additions & 15 deletions src/formCheckbox/__test__/FormCheckbox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('FormCheckbox', () => {
expect(checkbox).toBeDisabled();
});

it('should render a checkbox with aria label match name if unspecified', () => {
it('should render a checkbox with aria label being null if unspecified', () => {
const handleChange = jest.fn();

render(
Expand All @@ -146,9 +146,9 @@ describe('FormCheckbox', () => {
/>
);

expect(screen.getByLabelText('my label').getAttribute('aria-label')).toBe(
'group1'
);
expect(
screen.getByLabelText('my label').getAttribute('aria-label')
).toBeNull();
});

it('should render a checkbox with aria-data-controls and aria-labelledby as empty if unspecified', () => {
Expand Down Expand Up @@ -474,21 +474,19 @@ describe('FormCheckbox', () => {
expect(input.className.trim()).toBe('my-input-class');
});


it('should render a checkbox with a custom label', () => {
const handleChange = jest.fn();
render(
<FormCheckbox
id="myId"
name="group1"
value="choice 1"
label=
<>
This is a custom label{' '}
<a data-testid="mylink" href="link">
hello
</a>
</>
label=<>
This is a custom label{' '}
<a data-testid="mylink" href="link">
hello
</a>
</>
onChange={handleChange}
/>
);
Expand All @@ -511,9 +509,8 @@ describe('FormCheckbox', () => {
);

const checkboxContainer = container.querySelector('.dcx-checkbox--error');

expect(checkboxContainer).toBeInTheDocument();

});

it('should not apply error styling when isError is false', () => {
Expand Down Expand Up @@ -548,5 +545,4 @@ describe('FormCheckbox', () => {

expect(container.querySelector('.dcx-checkbox--error')).toBeNull();
});

});
7 changes: 3 additions & 4 deletions src/formInput/FormInputMasked.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ export const FormInputMasked = ({
...props
}: FormInputMaskedProps) => {
const inputRef = useRef<HTMLInputElement>(null);
const [mask, setMask] = useState<IMask.InputMask<
IMask.AnyMaskedOptions
> | null>(null);
const [mask, setMask] =
useState<IMask.InputMask<IMask.AnyMaskedOptions> | null>(null);

useEffect(() => {
if (mask && value) {
Expand Down Expand Up @@ -83,7 +82,7 @@ export const FormInputMasked = ({
{...props}
name={name}
type={type}
aria-label={ariaLabel || name}
aria-label={ariaLabel}
/>
);
};
3 changes: 1 addition & 2 deletions src/formSelect/FormSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
OptionGroup,
Hint,
Option,
Roles,
Label,
classNames,
} from '../common';
Expand Down Expand Up @@ -242,7 +241,7 @@ export const FormSelect = ({
name={name || 'formSelect'}
id={id || 'formSelect'}
className={selectClassName}
aria-label={ariaLabel || Roles.list}
aria-label={ariaLabel}
onChange={handleChange}
style={style}
tabIndex={tabIndex}
Expand Down
2 changes: 2 additions & 0 deletions stories/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ import { Meta } from '@storybook/blocks';
- [Button component - does not render the aria-label attribute properly](https://github.com/Capgemini/dcx-react-library/issues/618)
- [Tab - Actionable Element](https://github.com/Capgemini/dcx-react-library/issues/629)
- [FormRadio and FormInput - does not offer a capability to not add an aria-label](https://github.com/Capgemini/dcx-react-library/issues/621)
- [Checkbox - does not offer a capability to not add an aria-label](https://github.com/Capgemini/dcx-react-library/issues/650)
- [FormInput - does not offer a capability to not add an aria-label](https://github.com/Capgemini/dcx-react-library/issues/650)
- [FormInput - should not have a tabindex defined](https://github.com/Capgemini/dcx-react-library/issues/623)
- [FormInput - An aria attribute has been given an invalid value](https://github.com/Capgemini/dcx-react-library/issues/631)
- [Autocomplete - is not accessible and needs to be adjusted](https://github.com/Capgemini/dcx-react-library/issues/624)
Expand Down