diff --git a/js/src/button.js b/js/src/button.js index 0da2545119..08654d558e 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) => { diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index e92d229e6d..2adffedd9f 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -222,6 +222,46 @@ $(function () { assert.ok(!$btn2.find('input')[0].checked, 'btn2 is not checked') }) + QUnit.test('should fire click event on input', function (assert) { + assert.expect(1) + var done = assert.async() + var groupHTML = '