({
onInputChange={(value) => setSearch(value)}
onChange={(element) => handleChange(element)}
isDisabled={disabled}
+ aria-label={ariaLabel}
+ aria-required={ariaRequired}
/>
);
};
diff --git a/src/components/shared/wizard/RenderField.tsx b/src/components/shared/wizard/RenderField.tsx
index e3cb3a8edb..ddab602637 100644
--- a/src/components/shared/wizard/RenderField.tsx
+++ b/src/components/shared/wizard/RenderField.tsx
@@ -22,12 +22,16 @@ const RenderField = ({
form,
showCheck = false,
isFirstField = false,
+ ariaLabel,
+ ariaRequired = false,
}: {
field: FieldProps["field"]
metadataField: MetadataField
form: FieldProps["form"]
showCheck?: boolean,
isFirstField?: boolean,
+ ariaLabel?: string
+ ariaRequired?: boolean
}) => {
const { t } = useTranslation();
@@ -58,6 +62,8 @@ const RenderField = ({
form={form}
showCheck={showCheck}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)}
{metadataField.type === "text" &&
@@ -80,6 +86,8 @@ const RenderField = ({
setEditMode={setEditMode}
showCheck={showCheck}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)}
{metadataField.type === "ordered_text" && (
@@ -92,6 +100,8 @@ const RenderField = ({
setEditMode={setEditMode}
showCheck={showCheck}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)}
{metadataField.type === "text" &&
@@ -106,6 +116,8 @@ const RenderField = ({
setEditMode={setEditMode}
showCheck={showCheck}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)}
{metadataField.type === "text_long" && (
@@ -117,6 +129,8 @@ const RenderField = ({
setEditMode={setEditMode}
showCheck={showCheck}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)}
{metadataField.type === "date" && (
@@ -128,6 +142,8 @@ const RenderField = ({
setEditMode={setEditMode}
showCheck={showCheck}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)}
{metadataField.type === "boolean" && (
@@ -136,6 +152,8 @@ const RenderField = ({
form={form}
showCheck={showCheck}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)}
>
@@ -148,15 +166,19 @@ const EditableBooleanValue = ({
handleKeyDown,
form: { initialValues },
showCheck,
+ ariaLabel,
+ ariaRequired
}: {
field: FieldProps["field"]
handleKeyDown: (event: React.KeyboardEvent, type: string) => void
form: FieldProps["form"]
showCheck?: boolean,
+ ariaLabel?: string,
+ ariaRequired?: boolean,
}) => {
return (
handleKeyDown(e, "input")} ref={childRef}>
-
+
{showCheck && (
void
showCheck?: boolean,
+ ariaLabel?: string,
+ ariaRequired?: boolean
handleKeyDown: (event: React.KeyboardEvent, type: string) => void
}) => editMode ? (
@@ -203,13 +229,17 @@ const EditableDateValue = ({
},
onBlur: (event) => {
setEditMode(false)
+ },
+ inputProps: {
+ "aria-label": ariaLabel,
+ "aria-required": ariaRequired
}
}
}}
/>
) : (
- setEditMode(true)} className="show-edit">
+
-
+
);
// renders editable field for selecting value via dropdown
@@ -236,6 +266,8 @@ const EditableSingleSelect = ({
handleKeyDown,
form: { setFieldValue, initialValues },
showCheck,
+ ariaLabel,
+ ariaRequired
}: {
field: FieldProps["field"]
metadataField: MetadataField
@@ -245,6 +277,8 @@ const EditableSingleSelect = ({
handleKeyDown: (event: React.KeyboardEvent, type: string) => void
form: FieldProps["form"]
showCheck?: boolean,
+ ariaLabel?: string,
+ ariaRequired?: boolean,
}) => {
const { t } = useTranslation();
@@ -264,10 +298,12 @@ const EditableSingleSelect = ({
placeholder={`-- ${t("SELECT_NO_OPTION_SELECTED")} --`}
autoFocus={true}
defaultOpen={true}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
) : (
- setEditMode(true)} className="show-edit">
+
-
+
);
};
@@ -294,6 +330,8 @@ const EditableSingleValueTextArea = ({
handleKeyDown,
form: { initialValues },
showCheck,
+ ariaLabel,
+ ariaRequired,
}: {
field: FieldProps["field"]
text: string
@@ -302,6 +340,8 @@ const EditableSingleValueTextArea = ({
handleKeyDown: (event: React.KeyboardEvent, type: string) => void
form: FieldProps["form"]
showCheck?: boolean,
+ ariaLabel?: string,
+ ariaRequired?: boolean
}) => {
return editMode ? (
) : (
- setEditMode(true)} className="show-edit">
+
+
);
};
@@ -341,6 +383,8 @@ const EditableSingleValue = ({
setEditMode,
handleKeyDown,
showCheck,
+ ariaLabel,
+ ariaRequired,
}: {
field: FieldProps["field"]
form: FieldProps["form"]
@@ -349,6 +393,9 @@ const EditableSingleValue = ({
setEditMode: (e: boolean) => void
handleKeyDown: (event: React.KeyboardEvent, type: string) => void
showCheck?: boolean,
+ ariaLabel?: string,
+ ariaRequired?: boolean
+
}) => {
return editMode ? (
handleKeyDown(e, "input")}
ref={childRef}
>
-
+
) : (
- setEditMode(true)} className="show-edit">
+
+
);
};
@@ -384,6 +431,8 @@ const EditableSingleValueTime = ({
setEditMode,
showCheck,
handleKeyDown,
+ ariaLabel,
+ ariaRequired
}: {
field: FieldProps["field"]
text: string
@@ -391,7 +440,9 @@ const EditableSingleValueTime = ({
editMode: boolean | undefined
setEditMode: (e: boolean) => void
showCheck?: boolean,
- handleKeyDown: (event: React.KeyboardEvent, type: string) => void
+ ariaLabel?: string,
+ ariaRequired?: boolean,
+ handleKeyDown: (event: React.KeyboardEvent, type: string) => void,
}) => {
const { t } = useTranslation();
@@ -412,13 +463,18 @@ const EditableSingleValueTime = ({
},
onBlur: () => {
setEditMode(false)
+ },
+ inputProps: {
+ "aria-label": ariaLabel,
+ "aria-required": ariaRequired
}
- }
+ },
+
}}
/>
) : (
- setEditMode(true)} className="show-edit">
+
-
+
);
};
diff --git a/src/components/shared/wizard/RenderMultiField.tsx b/src/components/shared/wizard/RenderMultiField.tsx
index 64b57daa83..c3dabfe980 100644
--- a/src/components/shared/wizard/RenderMultiField.tsx
+++ b/src/components/shared/wizard/RenderMultiField.tsx
@@ -16,12 +16,16 @@ const RenderMultiField = ({
field,
form,
showCheck = false,
+ ariaLabel,
+ ariaRequired = false,
}: {
fieldInfo: MetadataField
onlyCollectionValues?: boolean
field: FieldProps["field"]
form: FieldProps["form"]
showCheck?: boolean,
+ ariaLabel?: string
+ ariaRequired?: boolean
}) => {
// Indicator if currently edit mode is activated
const {editMode, setEditMode} = useClickOutsideField(childRef);
@@ -37,12 +41,14 @@ const RenderMultiField = ({
};
const handleKeyDown = (event: React.KeyboardEvent) => {
- // Check if pressed key is Enter
- if (event.keyCode === 13 && inputValue !== "") {
+ const { key } = event;
+ if (key === "Enter" && inputValue !== "") {
event.preventDefault();
-
submitValue();
}
+ if (key === "Escape") {
+ setEditMode(false);
+ }
};
const submitValue = (alternativeInput?: string) => {
@@ -97,6 +103,8 @@ const RenderMultiField = ({
handleChange={handleChange}
handleKeyDown={handleKeyDown}
handleBlur={submitValue}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
) : (
fieldInfo.type === "mixed_text" && (
@@ -108,6 +116,8 @@ const RenderMultiField = ({
removeItem={removeItem}
handleChange={handleChange}
handleKeyDown={handleKeyDown}
+ ariaLabel={ariaLabel}
+ ariaRequired={ariaRequired}
/>
)
)}
@@ -133,6 +143,8 @@ const EditMultiSelect = ({
removeItem,
field,
fieldValue,
+ ariaLabel,
+ ariaRequired
}: {
collection: { [key: string]: unknown }[]
handleKeyDown: (event: React.KeyboardEvent) => void
@@ -141,7 +153,9 @@ const EditMultiSelect = ({
inputValue: HTMLInputElement["value"]
removeItem: (key: number) => void
field: FieldProps["field"]
- fieldValue: FieldInputProps["value"]
+ fieldValue: FieldInputProps["value"],
+ ariaLabel?: string,
+ ariaRequired?: boolean,
}) => {
const { t } = useTranslation();
@@ -169,6 +183,8 @@ const EditMultiSelect = ({
placeholder={t("EDITABLE.MULTI.PLACEHOLDER")}
list="data-list"
autoFocus={true}
+ aria-label={ariaLabel}
+ aria-required={ariaRequired}
/>
{/* Display possible options for values as some kind of dropdown */}