Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Revert "feature/XW-87/select-WCAG"" #126

Merged
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

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

- 2.2.13:
- Updated Textarea and all Input components to allow aria-label.
- Updated Select components.
- 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.
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.13",
"description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
"main": "lib/index.js",
"scripts": {
Expand Down
15 changes: 15 additions & 0 deletions src/components/formFields/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ErrorMessage } from "./errorMessage/ErrorMessage";

export interface IInputProps {
name: string;
ariaLabel?: string;
disabled?: boolean;
defaultValue?: string;
icon?: JSX.Element;
Expand All @@ -20,6 +21,7 @@ export const InputPassword: React.FC<IInputProps & IReactHookFormProps> = ({
placeholder,
errors,
hideErrorMessage,
ariaLabel,
}) => {
return (
<>
Expand All @@ -28,6 +30,7 @@ export const InputPassword: React.FC<IInputProps & IReactHookFormProps> = ({
{...{ disabled, placeholder }}
{...register(name, { ...validation })}
invalid={errors[name]}
aria-label={ariaLabel}
/>
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
</>
Expand All @@ -44,13 +47,15 @@ export const InputText: React.FC<IInputProps & IReactHookFormProps> = ({
placeholder,
errors,
hideErrorMessage,
ariaLabel,
}) => (
<>
<Textbox
type="text"
{...{ defaultValue, disabled, placeholder, icon }}
{...register(name, { ...validation })}
invalid={errors[name]}
aria-label={ariaLabel}
/>
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
</>
Expand All @@ -66,6 +71,7 @@ export const InputEmail: React.FC<IInputProps & IReactHookFormProps> = ({
placeholder,
errors,
hideErrorMessage,
ariaLabel,
}) => (
<>
<Textbox
Expand All @@ -74,6 +80,7 @@ export const InputEmail: React.FC<IInputProps & IReactHookFormProps> = ({
{...{ defaultValue, disabled, placeholder, icon }}
{...register(name, { ...validation })}
invalid={errors[name]}
aria-label={ariaLabel}
/>
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
</>
Expand All @@ -89,13 +96,15 @@ export const InputURL: React.FC<IInputProps & IReactHookFormProps> = ({
placeholder,
errors,
hideErrorMessage,
ariaLabel,
}) => (
<>
<Textbox
type="url"
{...{ defaultValue, disabled, placeholder, icon }}
{...register(name, { ...validation })}
invalid={errors[name]}
aria-label={ariaLabel}
/>
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
</>
Expand All @@ -111,13 +120,15 @@ export const InputNumber: React.FC<IInputProps & IReactHookFormProps> = ({
placeholder,
errors,
hideErrorMessage,
ariaLabel,
}) => (
<>
<Textbox
type="number"
{...{ defaultValue, disabled, placeholder, icon }}
{...register(name, { ...validation, valueAsNumber: true })}
invalid={errors[name]}
aria-label={ariaLabel}
/>
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
</>
Expand All @@ -133,6 +144,7 @@ export const InputFloat: React.FC<IInputProps & IReactHookFormProps> = ({
placeholder,
errors,
hideErrorMessage,
ariaLabel,
}) => (
<>
<Textbox
Expand All @@ -141,6 +153,7 @@ export const InputFloat: React.FC<IInputProps & IReactHookFormProps> = ({
{...{ disabled, placeholder, icon, defaultValue }}
{...register(name, { ...validation, valueAsNumber: true })}
invalid={errors[name]}
aria-label={ariaLabel}
/>
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
</>
Expand All @@ -157,11 +170,13 @@ export const InputFile: React.FC<IInputFileProps & IInputProps & IReactHookFormP
defaultValue,
validation,
register,
ariaLabel,
}) => (
<input
className="denhaag-Textbox__input"
type="file"
{...{ defaultValue, disabled, accept }}
{...register(name, { ...validation })}
aria-label={ariaLabel}
/>
);
2 changes: 1 addition & 1 deletion src/components/formFields/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const SelectCreate = ({
element.setAttribute("role", "presentation");
}
});
document.querySelectorAll('[class*="a11yText-A11yText"]').forEach((element: any) => {
document.querySelectorAll('[class*="a11yText"]').forEach((element: any) => {
if (element.role !== "presentation") {
element.setAttribute("role", "presentation");
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/formFields/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Textarea as UtrechtTextarea } from "@utrecht/component-library-react/di

export interface ITextAreaProps {
name: string;
ariaLabel?: string;
disabled?: boolean;
defaultValue?: string;
hideErrorMessage?: boolean;
Expand All @@ -17,9 +18,15 @@ export const Textarea = ({
disabled,
defaultValue,
hideErrorMessage,
ariaLabel,
}: ITextAreaProps & IReactHookFormProps): JSX.Element => (
<>
<UtrechtTextarea {...register(name, { ...validation })} {...{ disabled, defaultValue }} invalid={errors[name]} />
<UtrechtTextarea
{...register(name, { ...validation })}
{...{ disabled, defaultValue }}
invalid={errors[name]}
aria-label={ariaLabel}
/>
{errors[name] && !hideErrorMessage && <ErrorMessage message={errors[name].message} />}
</>
);