diff --git a/js/src/button.js b/js/src/button.js index 45e1424ffd..97ccd4bf0e 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -96,11 +96,11 @@ const Button = (($) => { input.focus() } - } else { - this._element.setAttribute('aria-pressed', - !$(this._element).hasClass(ClassName.ACTIVE)) } + this._element.setAttribute('aria-pressed', + !$(this._element).hasClass(ClassName.ACTIVE)) + if (triggerChangeEvent) { $(this._element).toggleClass(ClassName.ACTIVE) } diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index d87b576102..c67cea345b 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -60,6 +60,17 @@ $(function () { assert.strictEqual($btn.attr('aria-pressed'), 'true', 'btn aria-pressed state is true') }) + QUnit.test('should toggle aria-pressed on buttons with container', function (assert) { + assert.expect(1) + var groupHTML = '