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

Redesign filter sidebar #112

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Redesign filter sidebar #112

merged 1 commit into from
Feb 8, 2024

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Feb 5, 2024

Why these changes are being introduced:

The filter sidebar can become unwieldy, as all available filters are shown at all times.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/GDT-127

How this addresses that need:

This restyles the filter sidebar as dropdown menus. In so doing, it also changes some behavior in the filter logic:

  • Number of results is listed in the filter sidebar header.
  • Applied filters are highlighted (previously, the 'applied' filter was added, but we hadn't done anything with it).
  • Clicking an applied filter removes that filter (this replaces the previous removal mechanism, which removed all applied filters).

Side effects of this change:

  • Some tests have been updated to reflect the new logic.
  • The sidebar elements have an animation that's tied to height. I've set the height to 200px and added a scroll-behavior rule if the number of filters available exceeds that height. This is somewhat different from how the advanced search sidebar works, so I wanted to draw attention to it unless there are any concerns.
  • The JS for the dropdown menus is so minimal that I included it in the view as a script tag, but I'm happy to load it via Sprockets if that's preferable.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

@mitlib mitlib temporarily deployed to timdex-ui-pi-gdt-127-fi-nkehkl February 5, 2024 17:55 Inactive
@coveralls
Copy link

coveralls commented Feb 5, 2024

Pull Request Test Coverage Report for Build 7835391112

  • 0 of 10 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 99.444%

Totals Coverage Status
Change from base Build 7743295163: 0.01%
Covered Lines: 358
Relevant Lines: 360

💛 - Coveralls

@JPrevost JPrevost self-assigned this Feb 5, 2024
Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can address the overlapping content before merge that would be great. If that proves hard to track down, I'd be okay with a ticket to loop back on it.

Otherwise this feels like what was requested to me and works with either mouse or keyboard navigation. 👍🏻

<div class="filter-options">
<ul class="category-terms list-unbulleted">
<% values.each do |term| %>
<li class="term">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure why, but the scroll overlaps the content initially in Safari. If I select an element (via tab for example) it reflows the display and looks correct.

Expanded but with nothing selected the scrollbar overlaps the content
Screenshot 2024-02-05 at 2 35 09 PM

Tabbed into an element, the overlap is fixed
Screenshot 2024-02-05 at 3 42 42 PM

@@ -64,7 +64,8 @@
<% if @filters.present? %>
<aside class="col1q filter-container">
<div id="filters">
<h2>Available filters</h2>
<h2 class="hd-3">Filter your results</h2>
<h3 class="hd-4"><em><%= @pagination[:hits] %> items</em></h3>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hits value is a bit confusing for larger sets as displayed here.

Search for "organic chemistry" and it displays 10000 items. It should probably display something something more like 10,000+ items. I think we should expect TIMDEX API/OpenSearch to report "more than 10000 items" as "10000" and adjust the UI to anticipate that.

If you want to handle that in a separate ticket that is fine with me.

@mitlib mitlib temporarily deployed to timdex-ui-pi-gdt-127-fi-zo4rmv February 6, 2024 21:10 Inactive
@jazairi jazairi requested a review from JPrevost February 6, 2024 21:33
@jazairi jazairi temporarily deployed to timdex-ui-pi-gdt-127-fi-zo4rmv February 6, 2024 21:33 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-gdt-127-fi-zo4rmv February 6, 2024 21:57 Inactive
@jazairi jazairi force-pushed the gdt-127-filter-redesign branch from 7c01cb1 to c3cd424 Compare February 6, 2024 21:59
@jazairi jazairi temporarily deployed to timdex-ui-pi-gdt-127-fi-zo4rmv February 6, 2024 21:59 Inactive
@jazairi
Copy link
Contributor Author

jazairi commented Feb 6, 2024

The latest commit addresses the initial feedback on this, both from this review and from Darcy (I shared it with her in a meeting yesterday afternoon). There are also a couple of things that came up while I was doing some testing related to the code review/QA feedback. More details in the commit message.

I opened GDT-173 to meet Darcy's request of preserving menu state between page loads. I experimented with that a fair amount today but couldn't get it to work, and it was taking enough time that I figured a separate ticket was appropriate.

Why these changes are being introduced:

The filter sidebar can become unwieldy, as all available filters
are shown at all times.

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/GDT-127
* https://mitlibraries.atlassian.net/browse/GDT-173
* https://mitlibraries.atlassian.net/browse/GDT-174

How this addresses that need:

This restyles the filter sidebar as dropdown menus. In so doing,
it also changes some behavior in the filter logic:

* Number of results is listed in the filter sidebar header.
* Clicking an applied filter removes that filter (this replaces the
previous removal mechanism, which removed all applied filters).
* Applied filters are highlighted with an `x` symbol, to indicate
that it can be removed on click. (Previously, the 'applied' filter
was added, but we hadn't done anything with it.)
* The first filter dropdown in the sidebar is always open, even if
no filters are applied.

Not addressed in this commit:

* Darcy asked that we persist menu state between page loads, such
that an open menu always remains open unless a user closes it
manually (e.g., if all filters have been removed in that category).
This proved relatively complex, so I opened GDT-173 to address it.
* There are some visual differences in how the sidebar appears
in smaller viewports. This is covered in GDT-174.

Side effects of this change:

* Some tests have been updated to reflect the new logic.
* One potential a11y issue with filter categories is having to
navigate through a bunch of filter opens before getting to the
next category. We might want to add skip-content links if this
feels onerous.
* The JS for the dropdown menus is so minimal that I included it
in the view as a `script` tag.
* The filter container is now above the results in the DOM.
@jazairi jazairi force-pushed the gdt-127-filter-redesign branch from c3cd424 to d965215 Compare February 8, 2024 20:12
@jazairi jazairi merged commit 113c1bf into main Feb 8, 2024
5 checks passed
@jazairi jazairi deleted the gdt-127-filter-redesign branch February 8, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants