Skip to content

Commit 6d694c5

Browse files
committed
fix: aria label issue for dropdown selectors
1 parent ae802e5 commit 6d694c5

22 files changed

+52
-13
lines changed

packages/pluggableWidgets/datagrid-dropdown-filter-web/src/DatagridDropdownFilter.editorPreview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function Preview(props: DatagridDropdownFilterPreviewProps): ReactElement {
1010
return (
1111
<Select
1212
className={props.class}
13+
ariaLabel={props.ariaLabel}
1314
style={parseStyle(props.style)}
1415
options={[]}
1516
empty={!props.clearable}

packages/pluggableWidgets/datagrid-dropdown-filter-web/src/__tests__/DatagridDropdownFilter.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const commonProps: DatagridDropdownFilterContainerProps = {
2424
multiSelect: false,
2525
clearable: false,
2626
emptySelectionCaption: dynamicValue("Select"),
27+
emptyOptionCaption: dynamicValue("None"),
28+
ariaLabel: dynamicValue("AriaLabel"),
2729
selectedItemsStyle: "text",
2830
selectionMethod: "checkbox"
2931
};

packages/pluggableWidgets/datagrid-dropdown-filter-web/src/__tests__/__snapshots__/DatagridDropdownFilter.spec.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ exports[`Dropdown Filter with single instance with single attribute renders corr
4747
class="widget-dropdown-filter-menu-slot"
4848
>
4949
<ul
50-
aria-labelledby="downshift-:r0:-label"
50+
aria-label="AriaLabel"
5151
class="widget-dropdown-filter-menu"
5252
id="downshift-:r0:-menu"
5353
role="listbox"

packages/pluggableWidgets/datagrid-dropdown-filter-web/src/components/AttrFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Connector(props: DatagridDropdownFilterContainerProps & EnumFilterProps
2424
<EnumFilterContainer
2525
{...props}
2626
multiselect={props.multiSelect}
27-
ariaLabel={props.ariaLabel?.value}
27+
ariaLabel={props.ariaLabel?.value ?? ""}
2828
className={props.class}
2929
styles={props.style}
3030
emptyOptionCaption={props.emptyOptionCaption?.value ?? ""}

packages/pluggableWidgets/datagrid-dropdown-filter-web/src/components/RefFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Connector(props: DatagridDropdownFilterContainerProps & RefFilterProps)
1010
<RefFilterContainer
1111
{...props}
1212
multiselect={props.multiSelect}
13-
ariaLabel={props.ariaLabel?.value}
13+
ariaLabel={props.ariaLabel?.value ?? ""}
1414
className={props.class}
1515
styles={props.style}
1616
emptyOptionCaption={props.emptyOptionCaption?.value ?? ""}

packages/shared/widget-plugin-dropdown-filter/src/containers/EnumFilterContainer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { EnumFilterStore } from "../stores/EnumFilterStore";
1818
import { FilterOptionsType, SelectedItemsStyleEnum, SelectionMethodEnum } from "../typings/widget";
1919

2020
export interface EnumFilterContainerProps {
21-
ariaLabel?: string;
21+
ariaLabel: string;
2222
className?: string;
2323
defaultValue?: string;
2424
emptyOptionCaption: string;
@@ -70,6 +70,7 @@ const SelectWidget = observer(function SelectWidget(props: EnumFilterContainerPr
7070
showCheckboxes={ctrl1.multiselect}
7171
className={props.className}
7272
style={props.styles}
73+
ariaLabel={props.ariaLabel}
7374
/>
7475
);
7576
});
@@ -85,6 +86,7 @@ const ComboboxWidget = observer(function ComboboxWidget(props: EnumFilterContain
8586
options={ctrl2.options}
8687
inputPlaceholder={ctrl2.inputPlaceholder}
8788
emptyCaption={ctrl2.emptyCaption}
89+
ariaLabel={props.ariaLabel}
8890
useComboboxProps={ctrl2.useComboboxProps}
8991
onClear={ctrl2.handleClear}
9092
onFocus={ctrl2.handleFocus}
@@ -112,6 +114,7 @@ const TagPickerWidget = observer(function TagPickerWidget(props: EnumFilterConta
112114
onBlur={ctrl3.handleBlur}
113115
inputPlaceholder={ctrl3.inputPlaceholder}
114116
emptyCaption={ctrl3.emptyCaption}
117+
ariaLabel={props.ariaLabel}
115118
empty={ctrl3.isEmpty}
116119
showCheckboxes={props.selectionMethod === "checkbox"}
117120
selectedStyle={props.selectedItemsStyle}

packages/shared/widget-plugin-dropdown-filter/src/containers/RefFilterContainer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { GateProvider } from "@mendix/widget-plugin-mobx-kit/GateProvider";
1919
import { DerivedPropsGate } from "@mendix/widget-plugin-mobx-kit/props-gate";
2020

2121
export interface RefFilterContainerProps {
22-
ariaLabel?: string;
22+
ariaLabel: string;
2323
className?: string;
2424
defaultValue?: string;
2525
emptyOptionCaption: string;
@@ -73,6 +73,7 @@ const SelectWidget = observer(function SelectWidget(props: RefFilterContainerPro
7373
showCheckboxes={ctrl1.multiselect}
7474
className={props.className}
7575
style={props.styles}
76+
ariaLabel={props.ariaLabel}
7677
/>
7778
);
7879
});
@@ -89,6 +90,7 @@ const ComboboxWidget = observer(function ComboboxWidget(props: RefFilterContaine
8990
options={ctrl2.options}
9091
inputPlaceholder={ctrl2.inputPlaceholder}
9192
emptyCaption={ctrl2.emptyCaption}
93+
ariaLabel={props.ariaLabel}
9294
useComboboxProps={ctrl2.useComboboxProps}
9395
onClear={ctrl2.handleClear}
9496
onFocus={ctrl2.handleFocus}
@@ -120,6 +122,7 @@ const TagPickerWidget = observer(function TagPickerWidget(props: RefFilterContai
120122
onMenuScroll={handleMenuScroll}
121123
inputPlaceholder={ctrl3.inputPlaceholder}
122124
emptyCaption={ctrl3.emptyCaption}
125+
ariaLabel={props.ariaLabel}
123126
empty={ctrl3.isEmpty}
124127
showCheckboxes={props.selectionMethod === "checkbox"}
125128
selectedStyle={props.selectedItemsStyle}

packages/shared/widget-plugin-dropdown-filter/src/controllers/EnumBaseController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface EnumBaseControllerProps {
5656
emptyOptionCaption: string;
5757
emptySelectionCaption: string;
5858
placeholder: string;
59+
ariaLabel: string;
5960
}
6061

6162
export interface CustomOption<T> {

packages/shared/widget-plugin-dropdown-filter/src/controllers/EnumComboboxController.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { ComboboxControllerMixin } from "./mixins/ComboboxControllerMixin";
55
export class EnumComboboxController extends ComboboxControllerMixin(EnumBaseController) {
66
constructor({ gate }: { gate: DerivedPropsGate<EnumBaseControllerProps> }) {
77
super({ gate, multiselect: false });
8-
this.inputPlaceholder = gate.props.placeholder ?? "Search";
8+
this.inputPlaceholder = gate.props.placeholder;
9+
this.emptyCaption = gate.props.emptySelectionCaption;
10+
this.ariaLabel = gate.props.ariaLabel;
911
}
1012
}

packages/shared/widget-plugin-dropdown-filter/src/controllers/EnumSelectController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export class EnumSelectController extends SelectControllerMixin(EnumBaseControll
77
super({ gate, multiselect: gate.props.multiselect });
88
this.emptyOption.caption = gate.props.emptyOptionCaption;
99
this.emptyCaption = gate.props.emptySelectionCaption;
10+
this.ariaLabel = gate.props.ariaLabel;
1011
}
1112
}

0 commit comments

Comments
 (0)