Skip to content

Commit c7e1504

Browse files
committed
add custom name for input to avoid rgaa issue in case of multiple form with same fields
1 parent 3ecff5e commit c7e1504

4 files changed

Lines changed: 5571 additions & 5565 deletions

File tree

src/form/basicWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const BasicWrapper = ({ entry, realEntry, children, render, functionalPro
4747

4848
return (
4949
<div className={`mrf-mt_10 ${className || ""}`} style={{ position: 'relative' }}>
50-
{computedLabel && <label className='mrf-flex mrf-ai_center mrf-mb_5' htmlFor={entry}>
50+
{computedLabel && <label className='mrf-flex mrf-ai_center mrf-mb_5' htmlFor={step?.name ?? entry}>
5151
<span>{computedLabel}</span>
5252
{step?.help && <>
5353
<ReactToolTip html={true} place={'bottom'} id={id} />

src/form/controlledInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ export const ControlledInput = (inputProps: Props) => {
8080
}
8181

8282
const props = {
83-
name: field.name,
83+
name: step.name ?? field.name,
8484
...step.props,
85-
id: entry,
85+
id: step.name ?? entry,
8686
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
8787
placeholder: step.placeholder,
8888
onChange: (e: ChangeEvent<HTMLInputElement>) => {

src/form/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export interface SchemaEntry {
6868
visible?: boolean | ((prop: { rawValues: { [x: string]: any }, value: any, informations?: Informations }) => boolean);
6969
disabled?: boolean | ((prop: { rawValues: { [x: string]: any }, value: any, informations?: Informations }) => boolean);
7070
label?: React.ReactNode | ((prop: { rawValues: { [x: string]: any }, value: any, informations?: Informations }) => React.ReactNode);
71+
name?: string;
7172
placeholder?: string;
7273
defaultValue?: any;
7374
help?: string;

0 commit comments

Comments
 (0)