Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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:

  1. Create a collapsible accordion in a collapsed state
  1. Activate a pane programmatically
  1. 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 8 years ago by Scott González

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 );

comment:2 Changed 8 years ago by khiltd

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.

Note: See TracTickets for help on using tickets.