Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make responsive adjustments to search input and field select #1374

Open
ggeisler opened this issue Dec 17, 2021 · 3 comments
Open

Make responsive adjustments to search input and field select #1374

ggeisler opened this issue Dec 17, 2021 · 3 comments
Labels

Comments

@ggeisler
Copy link
Contributor

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:

  • Remove the spaces around the slash in "Creator / Contributor". This is enough for the option label to be just completely visible and we'd have nothing else to do for this breakpoint. This solution, however, won't suffice for any other exhibit that has an option label longer than "Creator/Contributor".
  • Use the same approach as suggested above for the lg viewport: 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:

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
Copy link

mwerla commented Jan 6, 2022

@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
Copy link
Contributor

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.

  • In BL7/BS4, wrapping the #search_field select box in input-group-prepend largely solves the issue by causing the box to expand to fit the longest text string in any of its options. This can be edited in the BL file at app/components/blacklight/search_bar_component.html.erb and results look like this:
    Screen Shot 2022-03-04 at 10 41 09
    Screen Shot 2022-03-02 at 14 53 10
    @ggeisler let me know that he is not too concered about overly long text strings, as the longest option currently in DLME is "Creator / Contributor"

  • In BL8/BS5, the class input-group-prepend (and also append which is used in the template) are deprecated in favor of input-group-text so the approach needs to be different. As of today, there also seems to be a difference in BL 8, where this SearchBar component is not rendering exactly the same as in BL 7 (differences in mobile view, and the search button icon).

@jacobthill jacobthill moved this to Todo in DLME Access 2022 Sep 28, 2022
@jacobthill jacobthill added access and removed access labels Jan 4, 2023
@marlo-longley marlo-longley removed their assignment Feb 6, 2023
@jcoyne
Copy link
Contributor

jcoyne commented Feb 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Todo
Development

No branches or pull requests

6 participants