I have run into an issue with the Facet API "Show More" links when combining it with another JavaScript library (TinyNav). In the Facet API JavaScript code for the Show More link, it is assumed that the Show More link is the next sibling of the unordered list of facets like this:
<div>
<ul><li>...</li><li>...</li></ul>
<a class="facetapi-limit-link" href="#">Show more</a>
</div>
However, other libraries such as TinyNav may modify the markup with JavaScript in such a way that the Show More link is not the next sibling by adding their own elements after the <ul> after the Facet API JS has added the Show More link. For example TinyNav generates a <select> list of all of the facets in the <ul> making the markup:
<div>
<ul><li>...</li><li>...</li></ul>
<select class="tinynav"><option>...</option><option>...</option><option>...</option></select>
<a class="facetapi-limit-link" href="#">Show more</a>
</div>
With the <select> element between the <ul> and <a> tags, clicking the Show More / Show Less links does not have any effect. It would be better if the Facet API JavaScript was a little more flexible in how it searches for the facets upon clicking the Show More / Show Fewer links so a small change like this in the markup does not impact the functionality of the link. Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#3 | facetapi-show_more_link_siblings-2131773-3.patch | 988 bytes | cpliakas |
#1 | facetapi-show_more_link_siblings-2131773-1.patch | 958 bytes | jlapp |
Comments
Comment #1
jlapp CreditAttribution: jlapp commentedPlease see the attached patch which makes the Show More / Fewer link click logic a little more flexible in how it searches for the facets.
Comment #2
cpliakas CreditAttribution: cpliakas commentedComment #3
cpliakas CreditAttribution: cpliakas commentedRe-rolled against the HEAD.
Comment #6
cpliakas CreditAttribution: cpliakas commentedThanks for the contribution!
Comment #8
cpliakas CreditAttribution: cpliakas commented