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

Make tabnav responsive #1062

Merged
merged 4 commits into from
Aug 3, 2020
Merged

Make tabnav responsive #1062

merged 4 commits into from
Aug 3, 2020

Conversation

colinkeany
Copy link
Contributor

This PR makes the tabnav component responsive. Currently the tabs stack at responsive sizes. This PR makes it so they are horizontally scrollable.

Before After
Screen Shot 2020-04-08 at 2 48 46 PM responsive-tabnav

/cc @primer/ds-core

@colinkeany colinkeany requested a review from a team April 8, 2020 18:49
@vercel
Copy link

vercel bot commented Apr 8, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-css/gv1rs2nki
✅ Preview: https://primer-css-git-responsive-tabnav.primer.vercel.app

@ashygee ashygee added the fr-skip label Apr 8, 2020
@vdepizzol
Copy link
Contributor

@colinkeany how does this behave on small screens in the desktop? I worked with @jonrohan on repo tabs, and we went with some specific behaviors including overflow buttons for desktops.

On mobile, it looks weird the scrolling area takes only the tabnav container, and doesn't go all the way to the page margins...

@colinkeany
Copy link
Contributor Author

@vdepizzol this does get cut off at smaller sizes, and doesn't accomplish the illusion of scrolling off the page. That happens on the PR page because of the parent wrapper which adds padding around the entire page.

How did you and @jonrohan manage to work around that with the repo tabs?

@simurai
Copy link
Contributor

simurai commented Apr 9, 2020

The "Write + Preview" tabs for the comment input in issues have a responsive hack:

Screen Shot 2020-04-09 at 5 57 30 PM

I tried something similar a while back, see https://github.com/github/design-systems/issues/587#issuecomment-479446234. But because there can be that .tabnav-extra on the right, it's hard to predict when the tabs run out of space and the .tabnav-extra should move to its own line.

t2

That said, even though this PR doesn't solve all the cases, might still be an improvement over the current situation? 🤔

@colinkeany
Copy link
Contributor Author

That's a really nice take on this, @simurai! I'm going to mess around with this a bit more and see if there's anything we can do about the extra content (buttons and text).

@simurai
Copy link
Contributor

simurai commented Apr 10, 2020

Maybe there is a way with flex-wrap or grid? But it also depends a bit on the content if the .tabnav-extra should move above or below the tabs. Maybe we can have a certain default. But some cases still need manual tweaking.

@emilybrick
Copy link
Contributor

I like @simurai's suggestion of the extra tabnav widget + button content appearing above the tabnav in the case that there's no enough room.

The one exception would be in the case that the tabnav widgets (e.g. the markdown styling options) are specific to a single tab, like this:
Screenshot 2020-04-10 14 15 02
Screenshot 2020-04-10 14 15 07

☝️In this case, I'd imagine the widgets would go underneath the tab when that tab is selected ☝️

Aside from that, I think we should consider allowing the tabs themselves to horizontally scroll. It seems pretty natural that tabular content would scroll. If we used a kebab, similar to the repo nav that @vdepizzol is working on, we should just test what that feels like to have both present in the page (hopefully they won't be stacked right on top of each other in most scenarios).

@vercel vercel bot temporarily deployed to Preview July 8, 2020 10:44 Inactive
@vercel vercel bot temporarily deployed to Preview July 8, 2020 12:20 Inactive
src/navigation/tabnav.scss Outdated Show resolved Hide resolved
@simurai simurai removed the fr-skip label Jul 8, 2020
@vercel vercel bot temporarily deployed to Preview July 8, 2020 15:09 Inactive
Copy link
Contributor

@simurai simurai left a comment

Choose a reason for hiding this comment

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

Ok, let's give it a try.

For cases with a .tabnav-extra, we might have to look at them case by case. And do something like:

tabnav-extra float-md-right mb-2

So only move it to the right when there is enough space.

@simurai simurai changed the base branch from master to release-15.1.0 August 3, 2020 00:28
@simurai simurai merged commit c373293 into release-15.1.0 Aug 3, 2020
@simurai simurai deleted the responsive-tabnav branch August 3, 2020 00:28
@simurai simurai mentioned this pull request Aug 3, 2020
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants