Skip to main content

Search and Top Navigation

#7554 closed bug (notabug)

Opened July 17, 2011 06:17AM UTC

Closed July 17, 2011 03:25PM UTC

Last modified July 17, 2011 06:29PM UTC

Blindly invoking the click handler on programmatic activation is insufficient

Reported by: khiltd Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.accordion Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:
Description

Steps to reproduce:

1. Create a collapsible accordion in a collapsed state

2. Activate a pane programmatically

3. Activate that same pane programmatically

Outcome:

The accordion is completely collapsed.

Expected outcome:

The active pane should remain active.

Why this is valid:

If you're trying to create stateful pages with a hashchange framework, you need to be able to restore the state of the accordion on navigation changes regardless of whether or not the page has been reloaded. This bug makes this task impossible without wrapping the activate method with a check to determine whether or not the index being passed is already the active one, and frankly, providing this functionality by faking a click event is a rather lazy approach.

Attachments (0)
Change History (2)

Changed July 17, 2011 03:25PM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

This is the intended behavior. The activate method is the exact equivalent of mimicking the user activating the panel. What you want to do is set the active option via $( el ).accordion( "options", "active", index );

Changed July 17, 2011 06:29PM UTC by khiltd comment:2

That's an equally lazy justification for laziness. "Activate" should mean "activate," not "toggle." If that's the intended behavior then you should name your methods in a way that reflects it.