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

Add toggle for filters on mobile UI #123

Merged
merged 2 commits into from
Mar 4, 2024
Merged

Conversation

matt-bernhardt
Copy link
Member

@matt-bernhardt matt-bernhardt commented Feb 28, 2024

Why are these changes being introduced:

The result filters are awkward on a mobile display, and may only be
needed for some users. Rather than having them display by default,
and take up space that is very precious, we want to only show a UI
control to expose them when needed.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/gdt-174

How does this address that need:

  • This adds a button above the filters panel markup, and adds a few
    classes to the existing markup at the top of the filters panel.

  • With CSS, we hide the filters panel on the smallest screens using a
    new hidden-sm class. This class is then toggled via javascript when
    the user clicks on the UI button.

  • The javascript is part of a new file - app/javascript/filters.js -
    which is loaded by the filters partial.

Document any side effects to this change:

  • I'm not sure where best to add the .hidden-sm class to this codebase.
    For now I'm adding it to a new _layouts module.

  • During initial testing, it feels awkward to have competing scroll
    bars in the filter UI by imposing a maximum height on the panels.
    Because the user has now chosen explicitly to show the filters, it
    feels better to just have them take up the space they need, rather
    than making the user navigate overlapping scroll bars on a linear
    display. So this overrides the maximum filter panel height.

Developer

Env

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • No ENV implications

A11y

  • 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

  • Stakeholder approval has been confirmed (or is not needed)
  • Stakeholder approval will come during QA

Requires database migrations?

NO

Includes new or updated dependencies?

NO

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

@mitlib mitlib temporarily deployed to timdex-ui-pi-gdt-174-mo-d3lgzr February 28, 2024 16:21 Inactive
@coveralls
Copy link

coveralls commented Feb 28, 2024

Pull Request Test Coverage Report for Build 8146694535

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.454%

Totals Coverage Status
Change from base Build 8142811628: 0.0%
Covered Lines: 364
Relevant Lines: 366

💛 - Coveralls

@matt-bernhardt matt-bernhardt force-pushed the gdt-174-mobile-filters branch 2 times, most recently from ef0766e to c74f1df Compare February 29, 2024 19:15
@matt-bernhardt matt-bernhardt marked this pull request as ready for review February 29, 2024 19:22
@mitlib mitlib temporarily deployed to timdex-ui-pi-gdt-174-mo-2zaamt February 29, 2024 19:31 Inactive
@mitlib mitlib temporarily deployed to timdex-ui-pi-gdt-174-mo-2zaamt February 29, 2024 20:01 Inactive
** Why are these changes being introduced:

* The result filters are awkward on a mobile display, and may only be
  needed for some users. Rather than having them display by default,
  and take up space that is very precious, we want to only show a UI
  control to expose them when needed.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/gdt-174

** How does this address that need:

* This adds a button above the filters panel markup, and adds a few
  classes to the existing markup at the top of the filters panel.

* With CSS, we hide the filters panel on the smallest screens using a
  new hidden-sm class. This class is then toggled via javascript when
  the user clicks on the UI button.

* The javascript is part of a new file - app/javascript/filters.js -
  which is loaded by the filters partial.

** Document any side effects to this change:

* I'm not sure where best to add the .hidden-sm class to this codebase.
  For now I'm adding it to a new _layouts module.

* During initial testing, it feels awkward to have competing scroll
  bars in the filter UI by imposing a maximum height on the panels.
  Because the user has now chosen explicitly to show the filters, it
  feels better to just have them take up the space they need, rather
  than making the user navigate overlapping scroll bars on a linear
  display. So this overrides the maximum filter panel height.
@matt-bernhardt matt-bernhardt force-pushed the gdt-174-mobile-filters branch from 8714317 to c570cd3 Compare March 4, 2024 15:33
@jazairi jazairi self-assigned this Mar 4, 2024
Copy link
Contributor

@jazairi jazairi left a comment

Choose a reason for hiding this comment

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

Now that we have a layouts partial, I wonder if we should move these rules to it? If you agree, I can make that change amid another change or two that Darcy has requested to the 'Ask Us' panel.

@jazairi jazairi self-requested a review March 4, 2024 19:23
Copy link
Contributor

@jazairi jazairi left a comment

Choose a reason for hiding this comment

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

Sorry for the rescinded review. The code looks good, but we actually want this to break at 768px. See the 'results page' section of the UI details doc.

@mitlib mitlib temporarily deployed to timdex-ui-pi-gdt-174-mo-roldoy March 4, 2024 20:07 Inactive
Adam rightly pointed out that the mockups in this ticket called for the
mobile filter behavior to kick in at the medium screen size (below 768),
not small (below 480).

This swaps the change over to that screen size, replacing -sm with -md
as needed.
@mitlib mitlib temporarily deployed to timdex-ui-pi-gdt-174-mo-roldoy March 4, 2024 20:38 Inactive
@matt-bernhardt
Copy link
Member Author

Thanks for catching the needed break point - I've pushed a commit to make this all take effect at the medium screen size, not small.

As for whether we move those other rules into _layouts.scss.... that may be logical. I'm not quite clear at the moment, but it will likely look fine during code review - so if you want to include it under that ticket, that seems fine.

@matt-bernhardt matt-bernhardt merged commit 0cc75ed into main Mar 4, 2024
5 checks passed
@matt-bernhardt matt-bernhardt deleted the gdt-174-mobile-filters branch March 4, 2024 20:56
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