Skip to content

Commit 2273fc9

Browse files
committed
fix: update snapshots to reflect aria-checked and readonly attributes
1 parent b7f1906 commit 2273fc9

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

packages/pluggableWidgets/switch-web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Improved accessibility and input handling. Clicking the label now toggles the switch.
12+
913
## [4.2.2] - 2024-08-28
1014

1115
### Changed

packages/pluggableWidgets/switch-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/switch-web",
33
"widgetName": "Switch",
4-
"version": "4.2.2",
4+
"version": "4.3.0",
55
"description": "Toggle a boolean attribute",
66
"copyright": "© Mendix Technology BV 2025. All rights reserved.",
77
"license": "Apache-2.0",

packages/pluggableWidgets/switch-web/src/__tests__/__snapshots__/Switch.spec.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ exports[`Switch with editable value renders the structure correctly 1`] = `
66
class="widget-switch"
77
>
88
<input
9+
aria-checked="false"
910
aria-hidden="true"
1011
class="sr-only"
1112
id="com.mendix.widgets.custom.switch1"
13+
readonly=""
1214
tabindex="-1"
1315
type="checkbox"
1416
/>
@@ -34,10 +36,12 @@ exports[`Switch with readonly value renders the structure correctly 1`] = `
3436
class="widget-switch"
3537
>
3638
<input
39+
aria-checked="false"
3740
aria-hidden="true"
3841
class="sr-only"
3942
disabled=""
4043
id="com.mendix.widgets.custom.switch1"
44+
readonly=""
4145
tabindex="-1"
4246
type="checkbox"
4347
/>

packages/pluggableWidgets/switch-web/src/components/Switch.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export default function Switch(props: SwitchProps): ReactElement {
1818
type="checkbox"
1919
id={props.id}
2020
onClick={props.onClick}
21+
checked={props.isChecked}
22+
aria-checked={props.isChecked}
23+
readOnly
2124
className="sr-only"
2225
disabled={!props.editable}
2326
tabIndex={-1}

packages/pluggableWidgets/switch-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="Switch" version="4.2.2" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Switch" version="4.3.0" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Switch.xml" />
66
</widgetFiles>

0 commit comments

Comments
 (0)