site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Mobile: Height of ideas list makes for poor UX changing tabs or pagination

Open simonchampion opened this issue 5 years ago • 8 comments

Bug Description

The height of the list makes it so users will need to scroll down to use the pagination and scroll up again to switch tabs which makes for a rough experience.

Darren: Yes, just noticed this too. When you paginate, you are not sent to the top of the widget.

Asana link: https://app.asana.com/0/1200491083500938/1200759450014575

Screenshots

image


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • When navigating between pages in the Idea Hub widget, the viewport should scroll to the top of the current tab if it is smaller than the entire list (e.g. can happen on mobile devices).
    • The height itself should not be updated here, that is part of #3843.

Implementation Brief

  • When the page for Idea Hub pagination changes, scroll to the top of the Idea Hub widget if the Idea Hub widget header is not on-screen.
  • This behaviour should be placed in a useUpdateEffect hook that relies on the pagination value changing, so it doesn't trigger on first mount. It can be placed in the assets/js/modules/idea-hub/components/dashboard/DashboardIdeasWidget/index.js file as it already has a reference to the ideaHubContainer ref.
  • See #3898 for a proof-of-concept PR.

Test Coverage

  • N/A

Visual Regression Changes

  • N/A

QA Brief

  • On a small screen and/or mobile device, visit the Idea Hub widget on either the Site Kit dashboard or in Storybook—the behaviour should be the same in either place.
  • Visit the second page of pagination results.
  • Scroll such that the header of the Idea Hub widget is not on screen.
  • Click a pagination link to go to the previous, taller page.
  • The widget should be scrolled into view.

Following the steps above, if the widget was already entirely in view (eg on a large screen, tablet, etc.) the viewport should NOT be scrolled.

Changelog entry

  • Update Idea Hub widget pagination to scroll to widget top on page change if out of view.

simonchampion avatar Aug 12 '21 08:08 simonchampion

The AC says "if it is smaller than the entire list (e.g. can happen on mobile devices)."

But I don't think comparing height of widget < height of viewport is the correct check, because the user could have scrolled way down so that only the pagination buttons are visible.

IMHO we should just check if the header of the Ideas Hub Widget is visible, and scroll up if it's not.

This is my idea on desktop

https://user-images.githubusercontent.com/8496063/129477405-4aa11023-7d99-4654-96c5-b76e41f0db7a.mp4

Strangely on mobile this doesn't work in the Chrome dev tools. getBoundingClientRect() is returning very large values for the top when the screen width is reduced.

https://user-images.githubusercontent.com/8496063/129477756-c52a7bd8-212d-4986-86a2-d7a6b5c41f0f.mp4

I'll look into this again on Monday

PR here https://github.com/google/site-kit-wp/pull/3870

danielgent avatar Aug 15 '21 12:08 danielgent

I checked this out on an iPhone on BrowserStack and it works :thinking:

https://user-images.githubusercontent.com/8496063/129587190-703b6cc0-565d-48cd-b4c7-bba04d7deaf7.mp4

But when I try an Android device, ideaHubContainer.current.getBoundingClientRect().top is giving me values > 200 pixels when actually the widget is mostly out of view

danielgent avatar Aug 16 '21 15:08 danielgent

@tofumatt maybe on mobile we could have a sticky footer for the widget?

aaemnnosttv avatar Aug 17 '21 17:08 aaemnnosttv

This one might also be "automatically" solved with React Router, which tends to change scroll position very intelligently. But adding pagination to the routing is a bit more effort so the easy way is to scroll the idea hub widget whenever the pagination value is updated.

I think for now scrolling when the page changes is fine. Feel free to assign this to me in EB since I already started on the PR, if my IB looks good. 🙂

tofumatt avatar Aug 17 '21 21:08 tofumatt

IB :heavy_check_mark:

eugene-manuilov avatar Aug 18 '21 13:08 eugene-manuilov

@felixarntz @tofumatt while the current AC improves the experience, I wouldn't say that it really fixes the root problem: widget controls are separated between header and footer and it isn't easy to switch between the two when the widget is larger than the viewport.

If a user changes the page, it will scroll up, but what if they want to go back? They're forced to scroll down again to reach those controls. It may sound minor, but would be a rather poor experience to go back/forward several pages at a time. Ideally I think the pagination would be sticky, or maybe the list of ideas should simply be a single scrolling list without pages (maybe only for mobile?).

Considering we're going to show up to 20 pages of new ideas, I think we should try to make this a bit better for this case. What do you think?

aaemnnosttv avatar Aug 25 '21 11:08 aaemnnosttv

@aaemnnosttv That's a good point, but it would require a more significant UX effort to alter the UI, so let's open a separate issue for it. I think focusing this one on the easier (temporary) fix of scrolling up makes sense, as the larger UI change would likely take longer than until launch.

felixarntz avatar Aug 25 '21 16:08 felixarntz

QA Update ✅

Verified:

  • Tested this on Browserstack via our supported browsers + on Android and iOS devices with different screen sizes.

Can confirm that when you use the pagination buttons to go to the next and previous pages, the widget is scrolled into view.

https://user-images.githubusercontent.com/73545194/133107188-260e9727-6dad-41b5-94ff-c10cb19e44a1.mp4

Can confirm that the mobile behaviour does not occur when using desktop.

wpdarren avatar Sep 13 '21 15:09 wpdarren