Skip to content

Commit

Permalink
Bugfix: for location facets, only expand the current institution's to…
Browse files Browse the repository at this point in the history
…p-level value, and don't animate the initial expansion.

- especially relevant for Duke, where nested locations including the string Duke were impacted
- preventing the intial animated transition expanding the facet is likely better for a11y
  • Loading branch information
seanaery committed Mar 7, 2024
1 parent 02a8407 commit cf96f3d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/assets/javascripts/trln_argon/location_facet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ Blacklight.onLoad(function() {
var argonInstitution = $('#location-data').data('argon-institution');
var locationFacetLimit = $('#location-data').data('location-facet-limit');
var facetLocationWrapper = $('#facet-location_hierarchy_f');
var topLocationFacetItems = facetLocationWrapper.find('ul.facet-hierarchy > li');

// hide first two facets
facetLocationWrapper.find('.facet-select:contains("' + argonHSL + '")').closest('li').addClass("d-none");
facetLocationWrapper.find('.facet-select:contains("' + argonLAW + '")').closest('li').addClass("d-none");
// hide top-level HSL & Law facets
topLocationFacetItems.find('.facet-select:contains("' + argonHSL + '")').closest('li').addClass("d-none");
topLocationFacetItems.find('.facet-select:contains("' + argonLAW + '")').closest('li').addClass("d-none");

// open local institution and expand
facetLocationWrapper.find('.facet-select:contains("' + argonInstitution + '")').closest('li').addClass("twiddle-open");
facetLocationWrapper.find('.facet-select:contains("' + argonInstitution + '")').closest('li').children("ul.collapse").collapse('show');
// open top-level local institution and expand
topLocationFacetItems.find('.facet-select:contains("' + argonInstitution + '")').closest('li').addClass("twiddle-open");
topLocationFacetItems.find('.facet-select:contains("' + argonInstitution + '")').closest('li').children("ul.collapse").addClass("show");

// if there are more than 10 results
if ( facetLocationWrapper.find('ul.facet-hierarchy > .twiddle-open > ul > li').length > parseInt(locationFacetLimit) ) {
Expand Down

0 comments on commit cf96f3d

Please sign in to comment.