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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jlapp’s picture

Status: Active » Needs review
FileSize
958 bytes

Please see the attached patch which makes the Show More / Fewer link click logic a little more flexible in how it searches for the facets.

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community
cpliakas’s picture

Re-rolled against the HEAD.

  • cpliakas committed a5ccd14 on 7.x-1.x authored by jlapp
    Issue #2131773 by jlapp: "Show More" link JS is too tightly coupled to...

  • cpliakas committed 8dcff5c on 7.x-2.x authored by jlapp
    Issue #2131773 by jlapp: "Show More" link JS is too tightly coupled to...
cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the contribution!

Status: Fixed » Needs work

The last submitted patch, 3: facetapi-show_more_link_siblings-2131773-3.patch, failed testing.

cpliakas’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.