Skip to content

Commit 3865697

Browse files
committed
fix: update arialabel and wrapper props
1 parent 500749c commit 3865697

File tree

12 files changed

+63
-37
lines changed

12 files changed

+63
-37
lines changed

packages/pluggableWidgets/checkbox-radio-selection-web/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1414
### Changed
1515

1616
- The Caption property now appears below Entity.
17-
- The Caption property is now only visible if Custom content is set to 'No'.
1817
- Moved the Group name attribute to the General tab in the General property group.
1918

2019
## [1.0.0] - 2025-08-25

packages/pluggableWidgets/checkbox-radio-selection-web/src/CheckboxRadioSelection.editorConfig.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,6 @@ export function getProperties(
133133
});
134134
}
135135

136-
if (values.optionsSourceCustomContentType === "yes") {
137-
if (values.source === "context" && values.optionsSourceType === "association") {
138-
hidePropertiesIn(defaultProperties, values, [
139-
"optionsSourceAssociationCaptionType",
140-
"optionsSourceAssociationCaptionAttribute",
141-
"optionsSourceAssociationCaptionExpression"
142-
]);
143-
} else if (values.source === "database") {
144-
hidePropertiesIn(defaultProperties, values, [
145-
"optionsSourceDatabaseCaptionType",
146-
"optionsSourceDatabaseCaptionAttribute",
147-
"optionsSourceDatabaseCaptionExpression"
148-
]);
149-
}
150-
}
151-
152136
return defaultProperties;
153137
}
154138

packages/pluggableWidgets/checkbox-radio-selection-web/src/CheckboxRadioSelection.editorPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const preview = (props: CheckboxRadioSelectionPreviewProps): ReactElement
2222
labelId: `${id}-label`,
2323
readOnlyStyle: props.readOnlyStyle,
2424
ariaRequired: dynamic(false),
25+
ariaLabel: dynamic(""),
2526
groupName: dynamic(`${id}-group`),
2627
noOptionsText: "No options available"
2728
};

packages/pluggableWidgets/checkbox-radio-selection-web/src/CheckboxRadioSelection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default function CheckboxRadioSelection(props: CheckboxRadioSelectionCont
1919
readOnlyStyle: props.readOnlyStyle,
2020
ariaRequired: props.ariaRequired,
2121
groupName: props.groupName,
22+
ariaLabel: props.ariaLabel,
2223
noOptionsText: props.noOptionsText?.value ?? "No options available"
2324
};
2425

packages/pluggableWidgets/checkbox-radio-selection-web/src/CheckboxRadioSelection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
<description />
277277
<returnType type="Boolean" />
278278
</property>
279-
<property key="ariaLabel" type="string" defaultValue="" required="false">
279+
<property key="ariaLabel" type="textTemplate" required="false">
280280
<caption>Aria label</caption>
281281
<description />
282282
</property>

packages/pluggableWidgets/checkbox-radio-selection-web/src/__tests__/CheckboxRadioSelection.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe("CheckboxRadioSelection", () => {
6868
customEditabilityExpression: { status: "available", value: false } as any,
6969
readOnlyStyle: "bordered" as const,
7070
ariaRequired: { status: "available", value: false } as any,
71-
ariaLabel: "",
71+
ariaLabel: { status: "available", value: "" } as any,
7272
controlType: "checkbox" as const
7373
};
7474

packages/pluggableWidgets/checkbox-radio-selection-web/src/components/CheckboxSelection/CheckboxSelection.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import classNames from "classnames";
22
import { MouseEvent, ReactElement } from "react";
33
import { MultiSelector, SelectionBaseProps } from "../../helpers/types";
44
import { getValidationErrorId } from "../../helpers/utils";
5+
import { useWrapperProps } from "../../hooks/useWrapperProps";
56
import { CaptionContent } from "../CaptionContent";
67
import { ValidationAlert } from "@mendix/widget-plugin-component-kit/Alert";
78
import { Placeholder } from "../Placeholder";
@@ -11,6 +12,7 @@ export function CheckboxSelection({
1112
tabIndex = 0,
1213
inputId,
1314
ariaRequired,
15+
ariaLabel,
1416
readOnlyStyle,
1517
groupName,
1618
noOptionsText
@@ -34,15 +36,14 @@ export function CheckboxSelection({
3436

3537
return (
3638
<div
37-
className={classNames("widget-checkbox-radio-selection-list", {
38-
"widget-checkbox-radio-selection-readonly": isReadOnly,
39-
[`widget-checkbox-radio-selection-readonly-${readOnlyStyle}`]: isReadOnly
39+
{...useWrapperProps({
40+
inputId,
41+
isReadOnly,
42+
isCheckbox: true,
43+
readOnlyStyle,
44+
ariaRequired,
45+
ariaLabel
4046
})}
41-
role="group"
42-
aria-labelledby={`${inputId}-label`}
43-
aria-required={ariaRequired?.value}
44-
aria-describedby={!isSingleCheckbox && selector.validation ? errorId : undefined}
45-
aria-invalid={!isSingleCheckbox && selector.validation ? true : undefined}
4647
>
4748
{options.map((optionId, index) => {
4849
const isSelected = currentIds.includes(optionId);

packages/pluggableWidgets/checkbox-radio-selection-web/src/components/RadioSelection/RadioSelection.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
import { If } from "@mendix/widget-plugin-component-kit/If";
12
import classNames from "classnames";
23
import { ChangeEvent, MouseEvent, ReactElement } from "react";
34
import { SelectionBaseProps, SingleSelector } from "../../helpers/types";
45
import { getValidationErrorId } from "../../helpers/utils";
6+
import { useWrapperProps } from "../../hooks/useWrapperProps";
57
import { CaptionContent } from "../CaptionContent";
68
import { ValidationAlert } from "@mendix/widget-plugin-component-kit/Alert";
79
import { Placeholder } from "../Placeholder";
8-
import { If } from "@mendix/widget-plugin-component-kit/If";
910

1011
export function RadioSelection({
1112
selector,
1213
tabIndex = 0,
1314
inputId,
1415
ariaRequired,
16+
ariaLabel,
1517
readOnlyStyle,
1618
groupName,
1719
noOptionsText
@@ -43,15 +45,14 @@ export function RadioSelection({
4345

4446
return (
4547
<div
46-
className={classNames("widget-checkbox-radio-selection-list", {
47-
"widget-checkbox-radio-selection-readonly": isReadOnly,
48-
[`widget-checkbox-radio-selection-readonly-${readOnlyStyle}`]: isReadOnly
48+
{...useWrapperProps({
49+
inputId,
50+
isReadOnly,
51+
isCheckbox: asSingleCheckbox,
52+
readOnlyStyle,
53+
ariaRequired,
54+
ariaLabel
4955
})}
50-
role={asSingleCheckbox ? "group" : "radiogroup"}
51-
aria-labelledby={`${inputId}-label`}
52-
aria-required={ariaRequired?.value}
53-
aria-describedby={!asSingleCheckbox && selector.validation ? errorId : undefined}
54-
aria-invalid={!asSingleCheckbox && selector.validation ? true : undefined}
5556
>
5657
{options.map((optionId, index) => {
5758
const isSelected = currentId === optionId;

packages/pluggableWidgets/checkbox-radio-selection-web/src/helpers/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export interface SelectionBaseProps<Selector> {
8484
selector: Selector;
8585
tabIndex: number;
8686
ariaRequired: DynamicValue<boolean>;
87+
ariaLabel: DynamicValue<string> | undefined;
8788
groupName: DynamicValue<string> | undefined;
8889
noOptionsText: string;
8990
}

packages/pluggableWidgets/checkbox-radio-selection-web/src/helpers/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ export function getCustomCaption(values: CheckboxRadioSelectionPreviewProps): st
5959
export function getValidationErrorId(inputId?: string): string | undefined {
6060
return inputId ? inputId + "-validation-message" : undefined;
6161
}
62+
63+
export function getInputLabel(inputId: string): Element | null {
64+
return document.querySelector(`label[for="${inputId}"]`);
65+
}

0 commit comments

Comments
 (0)