From ff4792fcefbe7369c95cf7b2d06e7d211b1c3991 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 16 Feb 2016 04:05:41 -0800 Subject: js/tests/index.html: Replace jQuery event alias methods with functions that throw explanatory errors, instead of with undefined Refs https://github.com/twbs/bootstrap/pull/19219#issuecomment-184653699 [skip validator] --- js/tests/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/tests/index.html b/js/tests/index.html index a91725cc5..e4cbae42f 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -44,7 +44,10 @@ 'undelegate' ] for (var i = 0; i < eventAliases.length; i++) { - $.fn[eventAliases[i]] = undefined + var eventAlias = eventAliases[i] + $.fn[eventAlias] = function () { + throw new Error('Using the ".' + eventAlias + '()" method is not allowed, so that Bootstrap can be compatible with custom jQuery builds which exclude the "event aliases" module that defines said method. See https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md#js') + } } })() -- cgit v1.2.3 From a496cb8be4dd1ccd4610e06f425153c76defc594 Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Tue, 16 Feb 2016 14:16:27 +0000 Subject: Focus (visually hidden) input radio/checkbox This allows for keyboard navigation (e.g. arrow keys left/right to trigger different radio buttons) following an initial mouse click interaction --- js/src/button.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js') diff --git a/js/src/button.js b/js/src/button.js index 3144a3f10..adcf4c928 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -92,7 +92,10 @@ const Button = (($) => { input.checked = !$(this._element).hasClass(ClassName.ACTIVE) $(this._element).trigger('change') } + + $(input).trigger('focus') } + } else { this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)) -- cgit v1.2.3 From 83217479c3951cb0e6f8ab50def2d056a90f9dd5 Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Tue, 16 Feb 2016 21:24:29 +0000 Subject: Visual/manual test for checkbox/radio button kbd behavior --- js/tests/visual/button.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js') diff --git a/js/tests/visual/button.html b/js/tests/visual/button.html index a0388e777..fd277582e 100644 --- a/js/tests/visual/button.html +++ b/js/tests/visual/button.html @@ -17,6 +17,9 @@ +

For checkboxes and radio buttons, ensure that keyboard behavior is functioning correctly.

+

Navigate to the checkboxes with the keyboard (generally, using TAB / SHIFT + TAB), and ensure that SPACE toggles the currently focused checkbox. Click on one of the checkboxes using the mouse, ensure that focus was correctly set on the actual checkbox, and that SPACE toggles the checkbox again.

+
+

Navigate to the radio button group with the keyboard (generally, using TAB / SHIFT + TAB). If no radio button was initially set to be selected, the first/last radio button should receive focus (depending on whether you navigated "forward" to the group with TAB or "backwards" using SHIFT + TAB). If a radio button was already selected, navigating with the keyboard should set focus to that particular radio button. Only one radio button in a group should receive focus at any given time. Ensure that the selected radio button can be changed by using the and arrow keys. Click on one of the radio buttons with the mouse, ensure that focus was correctly set on the actual radio button, and that and change the selected radio button again.

+