sul-dlss / dlme

Digital Library of the Middle East web application, based on Spotlight
https://dlmenetwork.org/
Other
20 stars 2 forks source link

Make responsive adjustments to search input and field select #1374

Open ggeisler opened 2 years ago

ggeisler commented 2 years ago

Broken out of #1110.

At all viewport widths, the search field filter select menu is not wide enough to display the entire labels of various menu options, including the default option. Below are a couple of examples, but if you select the "Creator / Contributor" option you can see problems at any viewport width.

xs (below 576px)

Screen Shot 2021-12-17 at 9 51 48 AM

md

Screen Shot 2021-12-17 at 9 56 27 AM

Recommendation

I see similar problems with Spotlight (at least, Stanford Exhibits) so addressing this issue might be worth doing in Spotlight. The DLME case is a bit extreme, because one of our filter options is fairly long ("Creator / Contributor"), but some Stanford Exhibits have a roughly similar long option ("Author/Contributor") so I'm not sure we should treat it as a one-off DLME outlier.

Below I'll provide general recommendations for dealing with this at each breakpoint. The elements involved (the search input box and the associated search filter select) are arranged using flex and I found a couple of potential ways to adjust things but the developer who works on this might have better ideas for accomplishing the goal so I don't want to be too specific in my suggested fixes.

lg viewport

At lg viewport width, the custom select isn’t wide enough to display the longest label:

Screen Shot 2021-12-16 at 5 41 54 PM

The most straightforward possibility here is to increase the width of the filter select to ensure the "Creator / Contributor" option is completely visible, taking away the added width from the search input box (I think it's acceptable for the input to be a bit narrower at this viewport width).

We could apply this adjustment to a media query that is lg and above, to handle the xl viewport where the issue also exists. Alternatively, since the xl viewport has more available space between the main menu and the search elements, we could at xl and wider just widen the filter select and leave the width of the search input as is.

md viewport

At md viewport width, not only is there not space for a longer select box label, there isn’t sufficient space for the brandbar elements, resulting is undesirable alignment and line-breaking:

Screen Shot 2021-12-16 at 5 36 42 PM

The most straightforward fix here is to update the media query that currently adjusts the header elements for mobile at sm and narrower to apply those mobile header adjustments to md and narrower instead. We are already applying other mobile adjustments at md (e.g., shifting the sidebar to the top of the main content area and using full-width for each section rather than 3/9 side-by-side columns), so this shouldn't be visually confusing.

sm viewport

Here we have the full width of the viewport available for the search elements, but a long option like "Creator / Contributor" is not fully visible in the menu:

Screen Shot 2021-12-17 at 10 35 53 AM

Two options:

Screen Shot 2021-12-16 at 5 30 10 PM

xs viewport

Below sm the search elements are very crowded and not even the default option label completely fits:

Screen Shot 2021-12-17 at 10 42 41 AM

I think the solution here is to give the search filter 100% width, putting it on its own row above the search input:

Screen Shot 2021-12-16 at 5 23 53 PM

Note that this appears to be what Blacklight does (not sure if that is related to the recent BS5 upgrade or not, but for whatever reason, Spotlight doesn't seem to inherit this behavior):

Screen Shot 2021-12-17 at 10 45 25 AM

At xs then, we should basically do what Blacklight does, although I would suggest there be about 0.5rem vertical spacing between the two elements, as in my DLME example above.

mwerla commented 2 years ago

@ggeisler I think that these all are very good design solutions. For sm resolution, I would go for "increase the width of the filter select to ensure the "Creator / Contributor" option is completely visible, taking away the added width from the search input box".

marlo-longley commented 2 years ago

I investigated this issue during the DLME Workcycle ending 3/4/2022. Here are my notes as I was unable to push fixes this round:

This issue is likely best solved in the Blacklight repo, in the SearchBar view component. Currently DLME uses BL 7, which uses Bootstrap4. BL 8 uses Bootstrap5.

jcoyne commented 1 year ago

This is blocked by a release of Spotlight that supports Blacklight 8 and possibly a release of Spotlight that supports Bootstrap 5.