blacklight icon indicating copy to clipboard operation
blacklight copied to clipboard

Facet collapse breakpoint (facets-toggleable-md) should be customizable

Open seanaery opened this issue 3 years ago • 3 comments

The FacetGroupComponent view component has a hard-coded value for the classes: class: 'facets sidenav facets-toggleable-md'

This makes the facets collapse under a hamburger menu toggle below the large breakpoint (< 992px by default).

This works OK if you use the default col-lg-3 sidebar + col-lg-9 main content layout. But if you are overriding Blacklight's (useful) layout helpers to specify different classes (e.g., to keep the facets sidebar visible at the md or sm breakpoints), you'd also need to change facets-toggleable-md to be -sm or -xs.

Screen Shot 2022-06-08 at 3 09 37 PM

seanaery avatar Jun 08 '22 19:06 seanaery

Just to note that on recent releases of Blacklight, you should be able to override the template associated with that component in your application (app/components/blacklight/response/facet_group_component.html.erb) as a workaround - of course you could also implement an entirely new component.

Overriding helpers is IME a path to difficulty in maintenance - how would you go about it otherwise?

barmintor avatar Jun 09 '22 20:06 barmintor

(I'll add that overriding the component template is a maintenance risk, too - they're really intended to be private implementations.)

barmintor avatar Jun 09 '22 20:06 barmintor

Many thanks for taking a look at this @barmintor and especially for your perspective on maintenance costs. What I had in mind when creating the ticket was potentially adding the class as a new param on the FacetGroupComponent (much like id & title), so one could override the _facets.html.erb partial to specify custom classes when the component is instantiated.

That might also not be the best solution, and I defer to the Blacklight maintainers on the optimal approach. As someone currently working on several local Blacklight 6 -> 7 migrations, I wanted to point out these sidebar + content responsive layout classes as an area that Blacklight 6 had a precedent for customizing fairly easily.

seanaery avatar Jun 10 '22 17:06 seanaery