Skip to content

Commit 655b5e6

Browse files
committed
fix: accessibility issue with slider ariaLabelledBy
1 parent 822c1d4 commit 655b5e6

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

packages/pluggableWidgets/slider-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@mendix/slider-web",
33
"widgetName": "Slider",
4-
"version": "2.1.4",
4+
"version": "2.1.5",
55
"description": "Change a number value using a slider",
66
"copyright": "© Mendix Technology BV 2025. All rights reserved.",
77
"license": "Apache-2.0",

packages/pluggableWidgets/slider-web/src/components/Container.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ function InnerContainer(props: InnerContainerProps): ReactElement {
4242
min: props.min,
4343
max: props.max
4444
});
45+
// Label generated by systemProperty has the format: {widgetId}-label
46+
const ariaLabelledByForHandle = `${props.id}-label`;
4547

4648
return (
4749
<SliderComponent
@@ -58,6 +60,7 @@ function InnerContainer(props: InnerContainerProps): ReactElement {
5860
step={props.step}
5961
onChange={onChange}
6062
marks={marks}
63+
ariaLabelledByForHandle={ariaLabelledByForHandle}
6164
handleRender={handleRender}
6265
ref={sliderRef}
6366
/>

packages/pluggableWidgets/slider-web/src/components/__tests__/Slider.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ describe("Slider", () => {
88
const defaultSliderProps: SliderProps = {
99
min: -100,
1010
max: 100,
11-
step: 10
11+
step: 10,
12+
ariaLabelledByForHandle: "test-slider"
1213
};
1314

1415
function renderSlider(props?: Partial<SliderProps>): ReturnType<typeof render> {

packages/pluggableWidgets/slider-web/src/components/__tests__/__snapshots__/Slider.spec.tsx.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ exports[`Slider renders horizontal Slider correctly 1`] = `
2020
/>
2121
<div
2222
aria-disabled="false"
23+
aria-labelledby="test-slider"
2324
aria-orientation="horizontal"
2425
aria-valuemax="100"
2526
aria-valuemin="-100"
@@ -75,6 +76,7 @@ exports[`Slider renders markers correctly 1`] = `
7576
</div>
7677
<div
7778
aria-disabled="false"
79+
aria-labelledby="test-slider"
7880
aria-orientation="horizontal"
7981
aria-valuemax="100"
8082
aria-valuemin="-100"
@@ -143,6 +145,7 @@ exports[`Slider renders vertical Slider correctly 1`] = `
143145
/>
144146
<div
145147
aria-disabled="false"
148+
aria-labelledby="test-slider"
146149
aria-orientation="vertical"
147150
aria-valuemax="100"
148151
aria-valuemin="-100"

packages/pluggableWidgets/slider-web/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="Slider" version="2.1.4" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Slider" version="2.1.5" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Slider.xml" />
66
</widgetFiles>

0 commit comments

Comments
 (0)