Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick H. Lauke <redux@splintered.co.uk>2017-04-10 16:43:54 +0300
committerGitHub <noreply@github.com>2017-04-10 16:43:54 +0300
commit3f6e1faf45d503d670e01b600a0455e2da0fe660 (patch)
treebd4366e7094dcc6a92b704ed88e4f2606884c30e /js/src/button.js
parent278ddd0acd9700917791af0b67d44bc21ed17498 (diff)
Only change aria-pressed if it's not an input-based radio or checkbox group
* Only change aria-pressed if it's not an input-based radio or checkbox group aria-pressed="true"/aria-pressed="false" is really only useful for making on/off toggles out of, say, `<button>` elements. the attribute is useless (and potentially confusing/conflicting) on, say, `<label>` elements for an existing `<input type="radio">` or similar. * Add unit test for buttons.js and radio/checkbox inputs in button groups
Diffstat (limited to 'js/src/button.js')
-rw-r--r--js/src/button.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/src/button.js b/js/src/button.js
index 76c5cdd15f..6295d0db05 100644
--- a/js/src/button.js
+++ b/js/src/button.js
@@ -66,6 +66,7 @@ const Button = (($) => {
toggle() {
let triggerChangeEvent = true
+ let addAriaPressed = true
const rootElement = $(this._element).closest(
Selector.DATA_TOGGLE
)[0]
@@ -94,12 +95,15 @@ const Button = (($) => {
}
input.focus()
+ addAriaPressed = false
}
}
- this._element.setAttribute('aria-pressed',
- !$(this._element).hasClass(ClassName.ACTIVE))
+ if (addAriaPressed) {
+ this._element.setAttribute('aria-pressed',
+ !$(this._element).hasClass(ClassName.ACTIVE))
+ }
if (triggerChangeEvent) {
$(this._element).toggleClass(ClassName.ACTIVE)