Opened 11 years ago

Closed 10 years ago

Last modified 7 years ago

#4096 closed bug (notabug)

navigationFilter is broken

Reported by: obecker Owned by:
Priority: critical Milestone: 1.6
Component: ui.accordion Version: 1.6rc6
Keywords: Cc:
Blocked by: Blocking:

Description

The navigationFilter of ui.accordion is broken since it always selects <a> elements by default (which matches the default for the header option).

Line 50 currently is

var current = $(container).find("a").filter(options.navigationFilter);

it should be

var current = $(container).find(options.header).filter(options.navigationFilter);

Change History (5)

comment:1 Changed 11 years ago by Jörn Zaefferer

Milestone: TBD1.6
Owner: set to joern.zaefferer
Status: newaccepted

comment:2 Changed 11 years ago by Jörn Zaefferer

Milestone: 1.61.next
Owner: joern.zaefferer deleted
Status: acceptedassigned

The navigation-option may need some attention, but your proposed fix is invalid, too. For a click-accordion, links inside headers can't be visited.

The navigation option looks for all anchors to find the one that matches the current page, then activate the parent panel of that anchor.

Looking for just headers wouldn't provide any benefit.

comment:3 Changed 11 years ago by obecker

It may well be that I don't understand the entire logic behind the accordion (being a JQuery newby, though), however we changed the default <a> header to a <span> and with the provided fix this works like a charm:

$('#foobar').accordion({
   active: true,
   alwaysOpen: false,  
   header: "span.title",
   navigation : true,
   navigationFilter: function() {
       return $(this).hasClass('fooId#{param['fooId']}');
   }
});

(#{param['fooId']} evaluates to the fooId URL parameter)

comment:4 Changed 10 years ago by Jörn Zaefferer

Resolution: invalid
Status: assignedclosed

#4653 is related. Also, I see no reason to change the API of navigationFilter - for anything that can't be matched via navigationFilter, use the active-option instead.

comment:5 Changed 7 years ago by Scott González

Milestone: 1.next1.6
Note: See TracTickets for help on using tickets.