Skip to content

Commit

Permalink
Merge pull request #124 from ConductionNL/revert-115-feature/XW-87/se…
Browse files Browse the repository at this point in the history
…lect-WCAG

Revert "feature/XW-87/select-WCAG"
  • Loading branch information
remko48 authored Oct 16, 2023
2 parents 7e7e899 + 614a469 commit adf42a3
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 60 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

- **Version 2.2 (breaking changes from 2.1.x)**

- 2.2.12: Updated Select components to WCAG with aria-label and role.
- 2.2.11: Updated Primary and Secondary topnav to NLDS.
- 2.2.10: Added z-index to tooltip.
- 2.2.9: Added CardWrapper, CardHeader, CardHeaderTitle, CardHeaderDate to index.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@conduction/components",
"version": "2.2.12",
"version": "2.2.11",
"description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
"main": "lib/index.js",
"scripts": {
Expand Down
58 changes: 0 additions & 58 deletions src/components/formFields/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface ISelectProps {
control: Control<FieldValues, any>;
options: { label: string; value: string }[];
name: string;
ariaLabel?: string;
id?: string;
defaultValue?: any;
disabled?: boolean;
Expand Down Expand Up @@ -73,25 +72,7 @@ export const SelectMultiple = ({
hideErrorMessage,
menuPlacement,
placeholder,
ariaLabel,
}: ISelectProps & IReactHookFormProps): JSX.Element => {
React.useEffect(() => {
document.querySelectorAll('[id*="live-region"]').forEach((element: any) => {
if (element?.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
document.querySelectorAll('[class*="indicatorSeparator"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
document.querySelectorAll('[class*="a11yText-A11yText"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
}, []);
return (
<Controller
{...{ control, name, defaultValue }}
Expand All @@ -100,7 +81,6 @@ export const SelectMultiple = ({
return (
<>
<ReactSelect
aria-label={ariaLabel}
inputId={id}
value={value ?? ""}
className={clsx(styles.select, errors[name] && styles.error)}
Expand Down Expand Up @@ -132,25 +112,7 @@ export const SelectCreate = ({
hideErrorMessage,
menuPlacement,
placeholder,
ariaLabel,
}: ISelectProps & IReactHookFormProps): JSX.Element => {
React.useEffect(() => {
document.querySelectorAll('[id*="live-region"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
document.querySelectorAll('[class*="indicatorSeparator"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
document.querySelectorAll('[class*="a11yText-A11yText"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
}, []);
return (
<Controller
{...{ control, name, defaultValue }}
Expand All @@ -159,7 +121,6 @@ export const SelectCreate = ({
return (
<>
<CreatableSelect
aria-label={ariaLabel}
inputId={id}
value={value ?? ""}
placeholder={disabled ? "Disabled..." : placeholder ?? "Select one or more options..."}
Expand Down Expand Up @@ -192,25 +153,7 @@ export const SelectSingle = ({
hideErrorMessage,
menuPlacement,
placeholder,
ariaLabel,
}: ISelectProps & IReactHookFormProps): JSX.Element => {
React.useEffect(() => {
document.querySelectorAll('[id*="live-region"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
document.querySelectorAll('[class*="indicatorSeparator"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
document.querySelectorAll('[class*="a11yText-A11yText"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
});
}, []);
return (
<Controller
{...{ control, name, defaultValue }}
Expand All @@ -219,7 +162,6 @@ export const SelectSingle = ({
return (
<>
<ReactSelect
aria-label={ariaLabel}
inputId={id}
value={value ?? ""}
className={clsx(styles.select, errors[name] && styles.error)}
Expand Down

0 comments on commit adf42a3

Please sign in to comment.