Commit 5d6e9212 authored by Brian Leonard's avatar Brian Leonard Committed by Chris Rebert
Browse files

Don't deselect radio buttons in data-toggle; fixes #9920

Merges #10787
parent 934d1bca
1 merge request!11376Double-clicking on a .btn-ized radio button shouldn't de-select it
Showing with 10 additions and 4 deletions
+10 -4
......@@ -54,15 +54,21 @@
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons"]')
var changed = true
if ($parent.length) {
var $input = this.$element.find('input')
.prop('checked', !this.$element.hasClass('active'))
.trigger('change')
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
if ($input.prop('type') === 'radio') {
// see if clicking on current one
if ($input.prop('checked') && this.$element.hasClass('active'))
changed = false
else
$parent.find('.active').removeClass('active')
}
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
}
this.$element.toggleClass('active')
if (changed) this.$element.toggleClass('active')
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment