Skip to main content

Search and Top Navigation

#4959 closed bug (fixed)

Opened November 16, 2009 05:26AM UTC

Closed July 13, 2010 01:02PM UTC

accordion navigation failed to find header from a deeply located element

Reported by: hoball Owned by:
Priority: minor Milestone: 1.8.2
Component: ui.accordion Version: 1.7.2
Keywords: navigation, parent, level Cc:
Blocked by: Blocking:
Description

Currently the code for the option "navigation" inside ui.accordion.js is:

if ( o.navigation ) {
	var current = this.element.find("a").filter(o.navigationFilter);
	if ( current.length ) {
		if ( current.filter(o.header).length ) {
			this.active = current;
		} else {
			this.active = current.parent().parent().prev();
			current.addClass("ui-accordion-content-active");
		}
	}
}

This block of code is fixed to search 2 levels up for the header.

In my navigation menu, I am using more than 2 levels and this results a failure to make "navigation: true" works.

I have to manually fix it by adding one more parent().

Perhaps we may use the parents() method to make it more flexible.

$(document).ready(function() {
    $("#accordion").accordion({
        active: false,
        header: 'h3',
        collapsible: true,
        navigation: true
    });

});
<div id="accordion"><!-- START ACCORDION -->

    <h3><a href="#">Header</a></h3>
    <div>
        <h4>Subheader A</h4>
        <ul>
            <li><a href="sub-a-1.html">Link SubA 1</a><</li>
            <li><a href="sub-a-2.html">Link SubA 2</a><</li>
        </ul>

        <h4>Subheader B</h4>
        <ul>
            <li><a href="sub-b-1.html">Link SubB 1</a><</li>
            <li><a href="sub-b-2.html">Link SubB 1</a><</li>
        </ul>
    </div>

    <!-- // more main headers -->
    <h3></h3>
    <div></div>
</div><!-- END ACCORDION -->

Attachments (0)
Change History (2)

Changed November 17, 2009 12:45PM UTC by jzaefferer comment:1

milestone: TBD1.8

Changed July 13, 2010 01:02PM UTC by scottgonzalez comment:2

milestone: 1.91.8.2
resolution: → fixed
status: newclosed

This was fixed in a previous release. We now use .closest() instead of .parent().parent().