aboutsummaryrefslogtreecommitdiff
path: root/js/src/button.js
diff options
context:
space:
mode:
authorLaussel Loïc <[email protected]>2020-06-10 14:45:31 +0200
committerGitHub <[email protected]>2020-06-10 15:45:31 +0300
commite9f039d1fe3ecbd52c46c127a184b4d0d6f1c17f (patch)
treefde187f62c12b3fcb8af1b753f5a3587f631fafd /js/src/button.js
parentba6d5e802b7756492d20422b39f61e6448666720 (diff)
downloadbootstrap-e9f039d1fe3ecbd52c46c127a184b4d0d6f1c17f.tar.xz
bootstrap-e9f039d1fe3ecbd52c46c127a184b4d0d6f1c17f.zip
avoid preventing input event onclick (#30992)
* instead of stopping event if onclick is triggered on input, call toggle method only if its not on checkbox inside a label * add unit test * add a dedicated test to ensure click event is forward to label Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/src/button.js')
-rw-r--r--js/src/button.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/js/src/button.js b/js/src/button.js
index 0da254511..08654d558 100644
--- a/js/src/button.js
+++ b/js/src/button.js
@@ -153,10 +153,9 @@ $(document)
return
}
- if (initialButton.tagName === 'LABEL' && inputBtn && inputBtn.type === 'checkbox') {
- event.preventDefault() // work around event sent to label and input
+ if (initialButton.tagName !== 'LABEL' || inputBtn && inputBtn.type !== 'checkbox') {
+ Button._jQueryInterface.call($(button), 'toggle')
}
- Button._jQueryInterface.call($(button), 'toggle')
}
})
.on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, (event) => {