#7554 closed bug (notabug)
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:
- Create a collapsible accordion in a collapsed state
- Activate a pane programmatically
- 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.
Change History (2)
comment:1 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
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.
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 );