aboutsummaryrefslogtreecommitdiff
path: root/js/src/button.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2017-05-27 15:26:48 -0700
committerMark Otto <[email protected]>2017-05-27 15:26:48 -0700
commit8f67ac19a761b8d3ecc80485c3f54aa6ba4fa910 (patch)
treed5a2aba4e2e762b283e7cfe60f00e1f239105bbe /js/src/button.js
parent6c3f833076a9fa68601741e3e21bd07ad79b7d8a (diff)
parentdb44e4b311317ef760f8412cc33c84146959b248 (diff)
downloadbootstrap-8f67ac19a761b8d3ecc80485c3f54aa6ba4fa910.tar.xz
bootstrap-8f67ac19a761b8d3ecc80485c3f54aa6ba4fa910.zip
Merge branch 'v4-dev' into v4-docs-streamlined
Diffstat (limited to 'js/src/button.js')
-rw-r--r--js/src/button.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/js/src/button.js b/js/src/button.js
index 45e1424ff..722fd489d 100644
--- a/js/src/button.js
+++ b/js/src/button.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.0.0-alpha.5): button.js
+ * Bootstrap (v4.0.0-alpha.6): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ const Button = (($) => {
*/
const NAME = 'button'
- const VERSION = '4.0.0-alpha.5'
+ const VERSION = '4.0.0-alpha.6'
const DATA_KEY = 'bs.button'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -66,6 +66,7 @@ const Button = (($) => {
toggle() {
let triggerChangeEvent = true
+ let addAriaPressed = true
const rootElement = $(this._element).closest(
Selector.DATA_TOGGLE
)[0]
@@ -89,14 +90,23 @@ const Button = (($) => {
}
if (triggerChangeEvent) {
+ if (input.hasAttribute('disabled') ||
+ rootElement.hasAttribute('disabled') ||
+ input.classList.contains('disabled') ||
+ rootElement.classList.contains('disabled')) {
+ return
+ }
input.checked = !$(this._element).hasClass(ClassName.ACTIVE)
$(input).trigger('change')
}
input.focus()
+ addAriaPressed = false
}
- } else {
+ }
+
+ if (addAriaPressed) {
this._element.setAttribute('aria-pressed',
!$(this._element).hasClass(ClassName.ACTIVE))
}