From 1a982809f62ea2149e463fa8e95c3dfa9e74295b Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 10 Feb 2024 01:00:34 -0500 Subject: [PATCH] accessibility support for CheckBox --- lib/phast/client/scripts/controls/CheckBox.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/phast/client/scripts/controls/CheckBox.js b/lib/phast/client/scripts/controls/CheckBox.js index b265365..558efd3 100644 --- a/lib/phast/client/scripts/controls/CheckBox.js +++ b/lib/phast/client/scripts/controls/CheckBox.js @@ -36,11 +36,22 @@ function CheckBox(parentElement) var child = document.createElement("div"); child.className = "uwt-checkbox"; + child.tabIndex = 0; child.NativeObject = this; child.addEventListener("click", function(e) { this.NativeObject.ToggleChecked(); }); + child.addEventListener("keydown", function(e) + { + if (e.keyCode === KeyboardKeys.Space) + { + this.NativeObject.ToggleChecked(); + e.preventDefault(); + e.stopPropagation(); + return false; + } + }); var fa = document.createElement("i"); fa.className = "fa fa-check"; child.appendChild(fa);