Problem/Motivation

The List view on mobile is almost the same as the Grid view. Recommendation is to default the displsy on mobile (small size viewports) to the Grid view and to not have a List view option. Hide the Grid and List buttons

Steps to reproduce

1. After installing and enabling the project_browser module
2. Visit the /admin/module/browse page
3. View the page in a small viewport or perform these steps on a mobile device

Proposed resolution

Remove the option to choose between List view and Grid view on small viewports. Instead default the display to Grid view.

Remaining tasks

  • ✅ File an issue about this project
  • ☐ Manual Testing
  • ☐ Code Review
  • ☐ Accessibility Review
  • ☐ Automated tests needed/written?
CommentFileSizeAuthor
gridview-mobile.png75.28 KBleslieg
listview-mobile.png45.42 KBleslieg
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

leslieg created an issue. See original summary.

leslieg’s picture

Issue summary: View changes
leslieg’s picture

Issue summary: View changes
leslieg’s picture

Issue summary: View changes
bnjmnm’s picture

It may be worth either postponing this on #3284325: Consider merging Project & ProjectLIstView into one component or adding this to that issue's scope. If that lands, List and Project will be the same template that is already conditionally displayed so I imagine it wouldn't be too difficult to leverage <MediaQuery> to add an additional condition that determines if a project is shown as a card.

leslieg’s picture

Issue summary: View changes

srishtiiee made their first commit to this issue’s fork.

srishtiiee’s picture

@bnjmnm I think this issue can be addressed separately, even without landing #3284325: Consider merging Project & ProjectLIstView into one component as the toggle buttons are a part of ProjectBrowser.svelte and aren't affected by Project.svelte and ProjectListView.svelte. Opening an MR for the same.

srishtiiee’s picture

Status: Needs work » Needs review
bnjmnm’s picture

Status: Needs review » Needs work

The proposed solution was

Remove the option to choose between List view and Grid view on small viewports. Instead default the display to Grid view.

The current MR addresses the "Remove the option to choose between List view and Grid view on small viewports". It does not address the "Instead default the display to Grid view [when on mobile].", which also happens to be the part I believe would be much easier when #3284325: Consider merging Project & ProjectLIstView into one component lands.

leslieg’s picture

I'm thinking work can proceed on this issue now that #3284325: Consider merging Project & ProjectLIstView into one component has been completed.

narendrar’s picture

All good, except that test can be modified to prove that buttons are not available before window is resized.

bnjmnm’s picture

This isn't switching to grid on narrower viewports, just hiding the toggle. Provided info in the MR on how to get this taken care of without having to change much beyond what is already in place.

bnjmnm’s picture

Status: Needs work » Needs review

To confirm it properly switches to grid on narrow viewports, you can use inspector to look at any list item with the .project class. If you switch to list view on a wider viewport, that list item will have the .list class. Narrow the viewport and that class will become .grid when it's narrow enough to hide the view toggle. Similarly, it will switch back to .list once wide enough and the toggle is again visible.

narendrar’s picture

Status: Needs review » Reviewed & tested by the community

Tested manually and found that now on narrow viewports buttons are removed and when window is resized last option is selected. Marking as RTBC.

tim.plunkett made their first commit to this issue’s fork.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, merged!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.