Ticket #5841 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

Accordion active property inaccurate if nested accordion is present

Reported by: Nick_Craver Owned by:
Priority: minor Milestone: 1.8.3
Component: ui.accordion Version: 1.8.2
Keywords: accordion nested active Cc:
Blocking: Blocked by:

Description

I've setup a full demo here:  http://jsfiddle.net/nick_craver/RJgaG/

If you click on any section you'll see the index is including the child accordion's headers. It's happening because of how .active is set:

o.active = o.collapsible && clickedIsActive ? false : $('.ui-accordion-header', this.element).index(clicked);

It's looking for all headers, not just the ones belonging to this level accordion. It seems like it should be:

o.active = o.collapsible && clickedIsActive ? false : this.headers.index(clicked);

Here's that version running:  http://jsfiddle.net/nick_craver/dK6SD/

Change History

comment:1 Changed 4 years ago by Nick_Craver

To be clear what the bug is without viewing the demo, the active option of the accordion widget is incorrect if there's a nested accordion present. It's headers will be factored into the the active index calculation when they shouldn't be, causing an inaccurate, higher index to be reported.

comment:2 Changed 4 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from TBD to 1.9

Fixed in  f99068b. Thanks.

comment:3 Changed 4 years ago by scott.gonzalez

  • Milestone changed from 1.9 to 1.8.3

comment:4 Changed 4 years ago by Scott González

Accordion: Use this.headers instead of parsing the DOM to find headers when determining which panel is active. Fixes #5841 - Accordion active property inaccurate if nested accordion is present.

Changeset: f99068bb4ff7fc0ceec154ac8e3b63e088246047

Note: See TracTickets for help on using tickets.