Skip to content

Make sidebars responsive #17010

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

Merged
merged 3 commits into from
Mar 24, 2023
Merged

Make sidebars responsive #17010

merged 3 commits into from
Mar 24, 2023

Conversation

selfcontained
Copy link
Contributor

@selfcontained selfcontained commented Mar 23, 2023

Description

Step 1 to making sidebars responsive. Shifts the sidebar to a row that scrolls on smaller screens. Also made the <Heading1/> slightly smaller on small screens.

Header Header
image image

Follow Up Steps

  • Explore using a dropdown for the sidebar navigation items versus scrollable menu.
  • Explore adding a scrolling indicator on left/right edge of menu when there's more options off-screen.
  • Currently navigation on the submenu results in a full route re-render, which resets the scroll position of the menu. This PR shifts the active item into visibility, but it isn't able to maintain scroll position due to the re-render. We can address this in a followup by using nested routes w/ react-router, and only re-render the portions of the page that change as much as possible.

Related Issue(s)

Fixes #8133

How to test

Preview Env: https://bmh-respon4a5450a2ee.preview.gitpod-dev.com/user/account

  • Visit some of the pages with sidebar nav (user/org settings) on mobile and desktop.

Release Notes

NONE

Documentation

Build Options:

  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish Options
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer Options
  • with-ee-license
  • with-dedicated-emulation
  • with-ws-manager-mk2
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-bmh-responsive-sidebar.1 because the annotations in the pull request description changed
(with .werft/ from main)

@selfcontained selfcontained changed the title Bmh/responsive-sidebar Make sidebars responsive Mar 23, 2023
@selfcontained selfcontained marked this pull request as ready for review March 24, 2023 01:08
@selfcontained selfcontained requested a review from a team March 24, 2023 01:08
@selfcontained selfcontained requested a review from gtsiolis as a code owner March 24, 2023 01:08
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Mar 24, 2023
@gtsiolis
Copy link
Contributor

gtsiolis commented Mar 24, 2023

Looking at this now! 👀

Install Gitpod job seems successful.

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Code LGTM, tested and works nicely 🎨

/hold For @gtsiolis 's feedback

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Thanks for making this change, @selfcontained!

Left a few comments below following our discussion around this menu.

Approving additionally to unblock this but holding in case you'd like to address the UX comments below in this PR. Otherwise, we can open a follow-up issue to keep track of these issues.

Thanks also @geropl for the hold above.

/hold

}
}, [link, location.pathname]);

let classes = "flex block py-2 px-4 rounded-md whitespace-nowrap max-w-52";
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Probably not the best line to comment on this, but the initial idea waw to reuse the same tabs pattern we use in the dashboard. It should be ok to leave is as is for this PR but it'd be nicer for users to face a pattern they've seen before. Thoughts?

BEFORE AFTER
bmh-respon4a5450a2ee preview gitpod-dev com_usage(Pixel 5) bmh-respon4a5450a2ee preview gitpod-dev com_usage(Pixel 5) (1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yah, that def. looks better. What do you think you'd prefer here for the sidebar nav between the tab-bar or a dropdown?

  • A dropdown avoids some of the weird scroll positioning issues when you navigate described in another comment (which we can fix, but might take a bit).
  • The tab-bar nav options are a bit more discoverable since you can see (some of) them.

🤔

}
}, [link, location.pathname]);

let classes = "flex block py-2 px-4 rounded-md whitespace-nowrap max-w-52";
Copy link
Contributor

Choose a reason for hiding this comment

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

thought: Going with the tabs pattern will also help decrease the gap between the menu items and providing a hint for menu items overflowing the viewport.

className={classNames(
// Handle flipping between row and column layout
"flex flex-row md:flex-col items-center",
"w-full md:w-52 overflow-auto md:overflow-visible",
Copy link
Contributor

Choose a reason for hiding this comment

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

question: What do you think of making the horizontal scrollbar invisible? This works ok now with the pill-like design, but could clash with the tabs.

Screenshot 2023-03-24 at 13 06 10

Comment on lines +80 to +84
<Link to={link[0]} key={title} className="md:w-full">
<li ref={itemRef} className={classes}>
{title}
</li>
</Link>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Probably not the best line to comment about this, but could we not shift the menu items when an item is clicked? Noticed that clicking on an item moves it to the left side of the scrollable area, which sometimes seems a bit jarring, no?

Untitled.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yah, I didn't like this either, tried to explain it a bit in the PR description, but it's buried in there:

Currently navigation on the submenu results in a full route re-render, which resets the scroll position of the menu. This PR shifts the active item into visibility, but it isn't able to maintain scroll position due to the re-render. We can address this in a followup by using nested routes w/ react-router, and only re-render the portions of the page that change as much as possible.

Another thing to consider is if we did a dropdown for nav instead of this scrollbar or a tab-bar, it would avoid that issue.

@selfcontained
Copy link
Contributor Author

/unhold will followup with additional improvements

@roboquat roboquat merged commit 14f78f2 into main Mar 24, 2023
@roboquat roboquat deleted the bmh/responsive-sidebar branch March 24, 2023 23:32
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
Status: In Validation
Development

Successfully merging this pull request may close these issues.

Settings page on mobile layout
4 participants