Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle collapsed class on triggers even when manually invoked #14686

Merged
merged 1 commit into from
Oct 29, 2014

Conversation

hnrch02
Copy link
Collaborator

@hnrch02 hnrch02 commented Sep 25, 2014

Fixes #13636.

@hnrch02 hnrch02 added the js label Sep 25, 2014
@hnrch02 hnrch02 added this to the v3.2.1 milestone Sep 25, 2014
@hnrch02
Copy link
Collaborator Author

hnrch02 commented Sep 25, 2014

This turned out to be a rather large refactor as virtually all the behavior that happened by clicking a toggle was poorly implemented and did not respect potentially prevented show/hide events.

@cvrebert
Copy link
Collaborator

CC: @fat

+ '<div class="accordion-group"/>'
+ '<div class="accordion-group"/>'
+ '<div class="accordion-group"/>'
var accordionHTML = '<div class="panel-group accordion">'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we should make accordion an id instead of a class

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what I was thinking at first too but the whole unit test is about this group not having an ID but a class.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Nevermind then.

@hnrch02 hnrch02 force-pushed the collapsed-class-manual-invocation branch from 5916860 to 8c995e1 Compare October 3, 2014 06:14
@@ -116,6 +130,33 @@
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}

Collapse.prototype.getParent = function () {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fat Is this what you meant?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya

@hnrch02 hnrch02 force-pushed the collapsed-class-manual-invocation branch from 8c995e1 to 4b2646e Compare October 23, 2014 04:08
@hnrch02
Copy link
Collaborator Author

hnrch02 commented Oct 23, 2014

Pinging @fat for final review.

this.options = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger = $(this.options.trigger || '[data-toggle="collapse"]').filter('[href="#' + el.id + '"], [data-target="#' + el.id + '"]')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're worried about this being long, just break it onto multiple lilnes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why isn't '[data-toggle="collapse"]' just the default value for the trigger option?

@fat
Copy link
Member

fat commented Oct 28, 2014

seems mostly good, just small things

@hnrch02 hnrch02 force-pushed the collapsed-class-manual-invocation branch from 4b2646e to ed3a65f Compare October 29, 2014 03:34
hnrch02 added a commit that referenced this pull request Oct 29, 2014
Handle `collapsed` class on triggers even when manually invoked
@hnrch02 hnrch02 merged commit 36e3d07 into master Oct 29, 2014
@hnrch02 hnrch02 deleted the collapsed-class-manual-invocation branch October 29, 2014 03:42
@cvrebert cvrebert mentioned this pull request Oct 29, 2014
@elvirb
Copy link

elvirb commented Jan 23, 2015

This seems to still be broken in v3.3.2.

Is the expected usage: #('#collapsableElement').collapse({trigger: false})? This doesn't seem to actually close the collapsed element, but only toggle it. #('#collapsableElement').collapse('hide') also doesn't work. If an element is already collapsed, it will uncollapse it.

@hnrch02
Copy link
Collaborator Author

hnrch02 commented Feb 1, 2015

@elvirb Please file a new issue with a live example. Thanks.

@twbs twbs locked and limited conversation to collaborators Feb 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

js .collapse() invocations don't toggle the .collapsed class for any of the collapse control elements
4 participants