Skip to content

Commit

Permalink
fix: resolve the issue in input accessibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanm-crest committed Jan 2, 2025
1 parent 12ea7b6 commit eff4051
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ui/src/components/BaseFormView/BaseFormView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ class BaseFormView extends PureComponent<BaseFormProps, BaseFormState> {
disabled: false,
error: false,
display: true,
id: `${e.field}-${e.label}`,
};

if (e.type !== 'helpLink' && e.type !== 'custom') {
Expand Down Expand Up @@ -1376,6 +1377,7 @@ class BaseFormView extends PureComponent<BaseFormProps, BaseFormState> {
fileNameToDisplay={temState.fileNameToDisplay}
modifiedEntitiesData={temState.modifiedEntitiesData}
page={this.props.page}
id={temState.id}
/>
);
})}
Expand Down
2 changes: 2 additions & 0 deletions ui/src/components/CheckBoxComponent/CheckBoxComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface CheckBoxComponentProps {
handleChange: (field: string, value: 0 | 1) => void;
field: string;
disabled?: boolean;
id: string;
}

class CheckBoxComponent extends React.Component<CheckBoxComponentProps> {
Expand All @@ -27,6 +28,7 @@ class CheckBoxComponent extends React.Component<CheckBoxComponentProps> {
disabled={this.props.disabled}
selected={!(this.props.value ? isFalse(this.props.value) : true)}
appearance="checkbox"
id={this.props.id}
/>
);
}
Expand Down
4 changes: 4 additions & 0 deletions ui/src/components/ControlWrapper/ControlWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface ControlWrapperProps {
required?: boolean;
};
page?: string;
id?: number;
}

class ControlWrapper extends React.PureComponent<ControlWrapperProps> {
Expand Down Expand Up @@ -109,6 +110,7 @@ class ControlWrapper extends React.PureComponent<ControlWrapperProps> {
...this?.props?.entity,
...this.props?.modifiedEntitiesData,
page: this.props.page,
id: this.props.id,
}
)
: `No View Found for ${this?.props?.entity?.type} type`;
Expand Down Expand Up @@ -139,6 +141,7 @@ class ControlWrapper extends React.PureComponent<ControlWrapperProps> {
: isRequiredModified;

const label = this.props?.modifiedEntitiesData?.label || this?.props?.entity?.label || '';
const labelFor = this.props.id !== undefined ? this.props.id.toString() : undefined;
return (
this.props.display && (
<ControlGroupWrapper
Expand All @@ -151,6 +154,7 @@ class ControlWrapper extends React.PureComponent<ControlWrapperProps> {
labelWidth={240}
required={isFieldRequired}
label={label}
labelFor={labelFor}
>
<CustomElement>{rowView}</CustomElement>
</ControlGroupWrapper>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/RadioComponent/RadioComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class RadioComponent extends Component<RadioComponentProps> {
render() {
return (
<RadioBarWrapper
id={this.props.id}
inline
onChange={this.handleChange}
value={
Expand All @@ -47,6 +46,7 @@ class RadioComponent extends Component<RadioComponentProps> {
>
{this.props.controlOptions.items.map((item) => (
<RadioBarOption
id={this.props.id}
key={item.value}
value={getValueMapTruthyFalse(item.value, this.props.page)}
label={item.label}
Expand Down
2 changes: 2 additions & 0 deletions ui/src/types/components/BaseFormTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export type ModifyFieldsOnValue = Array<ModificationCriteria>;

export interface BaseFormStateData {
[x: string]: {
id: number | undefined;
disabled: boolean;
error: boolean;
fileNameToDisplay?: string;
Expand Down Expand Up @@ -165,6 +166,7 @@ export interface BasicEntity {
display: boolean;
value?: AcceptableFormValueOrNullish;
fileNameToDisplay?: string;
id?: string;
}

export interface ChangeRecord {
Expand Down

0 comments on commit eff4051

Please sign in to comment.