Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit c9b42c0

Browse files
authored
Add errorAriaLabel to all fields (#168)
1 parent 37666ab commit c9b42c0

File tree

8 files changed

+25
-1
lines changed

8 files changed

+25
-1
lines changed

lib/components/DateTime/DateField.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export interface DateFieldProps extends React.Props<DateFieldType> {
6464

6565
/** React node to render at the far side of the label. */
6666
labelFarSide?: React.ReactNode;
67+
/** Label to be announced before the error message to announce to the user that there's an error */
68+
errorAriaLabel?: string;
6769

6870
attr?: DatePickerAttributes & FormFieldAttributes;
6971
}
@@ -107,6 +109,7 @@ export const DateField: React.StatelessComponent<DateFieldProps> = (props: DateF
107109
attr={fieldAttr}
108110
tooltip={props.tooltip}
109111
labelFarSide={props.labelFarSide}
112+
errorAriaLabel={props.errorAriaLabel}
110113
disabled={props.disabled}
111114
>
112115
<DatePicker

lib/components/Field/CheckboxField.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export interface CheckboxFieldProps extends React.Props<CheckboxFieldType> {
4141
inputClassName?: string;
4242
/** React node to render at the far side of the label. */
4343
labelFarSide?: React.ReactNode;
44+
/** Label to be announced before the error message to announce to the user that there's an error */
45+
errorAriaLabel?: string;
4446

4547
attr?: FormFieldAttributes & CheckboxInputAttributes;
4648
}
@@ -87,6 +89,7 @@ export const CheckboxField: React.StatelessComponent<CheckboxFieldProps> = (prop
8789
className={props.className}
8890
attr={fieldAttr}
8991
labelFarSide={props.labelFarSide}
92+
errorAriaLabel={props.errorAriaLabel}
9093
disabled={props.disabled}
9194
>
9295
<div>

lib/components/Field/ComboField.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ export interface ComboFieldProps extends React.Props<ComboFieldType> {
110110
inputClassName?: string;
111111
/** React node to render at the far side of the label. */
112112
labelFarSide?: React.ReactNode;
113+
/** Label to be announced before the error message to announce to the user that there's an error */
114+
errorAriaLabel?: string;
113115

114116
attr?: ComboInputAttributes & FormFieldAttributes;
115117
}
@@ -174,6 +176,7 @@ export const ComboField: React.StatelessComponent<ComboFieldProps> = (props: Com
174176
className={props.className}
175177
attr={fieldAttr}
176178
labelFarSide={props.labelFarSide}
179+
errorAriaLabel={props.errorAriaLabel}
177180
disabled={props.disabled}
178181
>
179182
<div>

lib/components/Field/RadioField.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export interface RadioFieldProps extends React.Props<RadioFieldType> {
5252
inputClassName?: string;
5353
/** React node to render at the far side of the label. */
5454
labelFarSide?: React.ReactNode;
55+
/** Label to be announced before the error message to announce to the user that there's an error */
56+
errorAriaLabel?: string;
5557

5658
attr?: RadioInputAttributes & FormFieldAttributes;
5759
}
@@ -131,6 +133,7 @@ export const RadioField: React.StatelessComponent<RadioFieldProps> = (props: Rad
131133
className={props.className}
132134
attr={fieldAttr}
133135
labelFarSide={props.labelFarSide}
136+
errorAriaLabel={props.errorAriaLabel}
134137
disabled={props.disabled}
135138
>
136139
<div>

lib/components/Field/SelectField.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export interface SelectFieldProps extends React.Props<SelectFieldType> {
5151
inputClassName?: string;
5252
/** React node to render at the far side of the label. */
5353
labelFarSide?: React.ReactNode;
54-
54+
/** Label to be announced before the error message to announce to the user that there's an error */
55+
errorAriaLabel?: string;
56+
5557
attr?: SelectInputAttributes & FormFieldAttributes;
5658
}
5759

@@ -94,6 +96,7 @@ export const SelectField: React.StatelessComponent<SelectFieldProps> = (props: S
9496
className={props.className}
9597
attr={fieldAttr}
9698
labelFarSide={props.labelFarSide}
99+
errorAriaLabel={props.errorAriaLabel}
97100
disabled={props.disabled}
98101
>
99102
<SelectInput

lib/components/Field/TextAreaField.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export interface TextAreaFieldProps extends React.Props<TextAreaFieldType> {
4646
inputClassName?: string;
4747
/** React node to render at the far side of the label. */
4848
labelFarSide?: React.ReactNode;
49+
/** Label to be announced before the error message to announce to the user that there's an error */
50+
errorAriaLabel?: string;
4951

5052
attr?: TextAreaAttributes & FormFieldAttributes;
5153
}
@@ -81,6 +83,7 @@ export const TextAreaField: React.StatelessComponent<TextAreaFieldProps> = (prop
8183
className={props.className}
8284
attr={fieldAttr}
8385
labelFarSide={props.labelFarSide}
86+
errorAriaLabel={props.errorAriaLabel}
8487
disabled={props.disabled}
8588
>
8689
<TextArea

lib/components/Field/TextField.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export interface TextFieldProps extends React.Props<TextFieldType> {
5959
inputClassName?: string;
6060
/** Extra action to render at the far side of the label */
6161
labelFarSide?: React.ReactNode;
62+
/** Label to be announced before the error message to announce to the user that there's an error */
63+
errorAriaLabel?: string;
6264

6365
attr?: TextInputAttributes & FormFieldAttributes;
6466
}
@@ -104,6 +106,7 @@ export const TextField: React.StatelessComponent<TextFieldProps> = (props: TextF
104106
className={props.className}
105107
attr={fieldAttr}
106108
labelFarSide={props.labelFarSide}
109+
errorAriaLabel={props.errorAriaLabel}
107110
disabled={props.disabled}
108111
>
109112
<TextInput

lib/components/Field/ToggleField.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export interface ToggleFieldProps extends React.Props<ToggleFieldType> {
4444
inputClassName?: string;
4545
/** React node to render at the far side of the label. */
4646
labelFarSide?: React.ReactNode;
47+
/** Label to be announced before the error message to announce to the user that there's an error */
48+
errorAriaLabel?: string;
4749

4850
attr?: FormFieldAttributes & ToggleAttributes;
4951
}
@@ -82,6 +84,7 @@ export const ToggleField = React.memo((props: ToggleFieldProps) => {
8284
className={props.className}
8385
attr={fieldAttr}
8486
labelFarSide={props.labelFarSide}
87+
errorAriaLabel={props.errorAriaLabel}
8588
disabled={props.disabled}
8689
>
8790
<Toggle

0 commit comments

Comments
 (0)