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

UnderlineNav overflow behaviour implementation #2297

Merged
merged 35 commits into from
Sep 28, 2022

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Sep 1, 2022

Closes #1251

This PR addresses the overflow behaviour implementation that is described in the design issue.

TODO:

  • Auto hide the icons when overflow occurs
  • Update More menu button styles
  • Implement scroll behaviour for coarse pointer devices
  • Enhanced scroll styling
    • fading affect for showing/hiding the arrow buttons
    • Blur effect to indicate there are more items on the scroll
    • Scroll selected item into the view

Current built on storybook: https://primer-463f4c80a3-13348165.drafts.github.io/storybook/?path=/story/layout-underlinenav-examples--internal-responsive-nav

Current built on docs: https://primer-463f4c80a3-13348165.drafts.github.io/drafts/UnderlineNav2

Light Theme

More Menu

Screen Shot 2022-09-14 at 1 56 47 pm

Scroll

Screen Shot 2022-09-14 at 1 57 06 pm

Dark Theme (Dimmed)

More Menu

Screen Shot 2022-09-14 at 1 13 45 pm

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented Sep 1, 2022

🦋 Changeset detected

Latest commit: 80e52e3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 77.1 KB (0%)
dist/browser.umd.js 77.71 KB (0%)

@broccolinisoup broccolinisoup temporarily deployed to github-pages September 1, 2022 11:24 Inactive
@broccolinisoup broccolinisoup force-pushed the broccolinisoup/UnderlineNav-states branch from d87eb23 to fcf6cf5 Compare September 4, 2022 23:45
@broccolinisoup broccolinisoup force-pushed the broccolinisoup/underlineNav-overflow branch from c3d6d67 to fc79da0 Compare September 5, 2022 01:37
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 5, 2022 01:43 Inactive
Base automatically changed from broccolinisoup/UnderlineNav-states to main September 5, 2022 08:34
@broccolinisoup broccolinisoup force-pushed the broccolinisoup/underlineNav-overflow branch from fc79da0 to 5c13fb5 Compare September 6, 2022 07:00
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 6, 2022 07:07 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 7, 2022 22:14 Inactive
const {theme} = useTheme()
useLayoutEffect(() => {
const domRect = (ref as MutableRefObject<HTMLElement>).current.getBoundingClientRect()
// might want to select this better
const icon = (ref as MutableRefObject<HTMLElement>).current.children[0].children[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe you can add data-component?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried selecting the icons using data-component item.getAttribute('data-component') === 'leadingIcon' but icon gets undefined if any item goes into more menu and comes back 🤔 Weird, I'll look into it again but keeping as is for now.

@broccolinisoup broccolinisoup force-pushed the broccolinisoup/underlineNav-overflow branch from b3650f8 to 6231df7 Compare September 11, 2022 22:21
@broccolinisoup broccolinisoup added the skip changeset This change does not need a changelog label Sep 11, 2022
@broccolinisoup
Copy link
Member Author

Adding skip changeset label just to avoid running changeset while keeping the PR draft. I'll remove it and add changeset when it is ready for review.

@broccolinisoup broccolinisoup temporarily deployed to github-pages September 11, 2022 22:28 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 11, 2022 23:40 Inactive
@pksjce pksjce temporarily deployed to github-pages September 12, 2022 05:27 Inactive
@pksjce pksjce temporarily deployed to github-pages September 12, 2022 05:51 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 12, 2022 11:59 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 13, 2022 04:24 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 19, 2022 01:49 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 19, 2022 03:27 Inactive
@danielguillan
Copy link
Contributor

This is looking great @broccolinisoup!

My only concern, as you've mentioned in the recording, is that the "more" menu behavior on coarse pointer devices is problematic on small viewports. I don't think it's a good pattern to solve this problem on mobile devices. I've added a comment on the design issue to see if we can find alternatives.

@broccolinisoup
Copy link
Member Author

This is looking great @broccolinisoup!

My only concern, as you've mentioned in the recording, is that the "more" menu behavior on coarse pointer devices is problematic on small viewports. I don't think it's a good pattern to solve this problem on mobile devices. I've added a comment on the design issue to see if we can find alternatives.

Awesome! @danielguillan We have the scroll behaviour in the commit, so we can always bring it back. I am keeping an eye on the design issue to see what our next step is.

@broccolinisoup broccolinisoup temporarily deployed to github-pages September 21, 2022 04:25 Inactive
@broccolinisoup
Copy link
Member Author

@danielguillan I reverted the commit to bring the scroll behaviour back and addressed your feedback around it as well. The only thing I would say is that the slide-in and out animated effect is a bit tricky to do with react. I understand about giving us more real estate. I played with it a little bit more to give more space to click while maintaining the padding etc. Do you think we can go with the current implementation for now and merge this PR if all other concerns are address? It became quite big and I have another PR coming up (making selected item always visible) so would be great to merge this to avoid conflicts and make it available under the drafts?

In the meantime, I'll try to get some support for css & react animation to achieve slide in and out behaviour.

@broccolinisoup broccolinisoup temporarily deployed to github-pages September 21, 2022 05:03 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 22, 2022 23:02 Inactive
Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

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

I skimmed the implementation and nothing stood out as a blocker. Going to give a 👍 since @pksjce is happy with it.

.changeset/sweet-eggs-complain.md Outdated Show resolved Hide resolved
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 28, 2022 02:27 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 28, 2022 03:04 Inactive
@broccolinisoup broccolinisoup temporarily deployed to github-pages September 28, 2022 03:16 Inactive
@broccolinisoup broccolinisoup merged commit cad2bc0 into main Sep 28, 2022
@broccolinisoup broccolinisoup deleted the broccolinisoup/underlineNav-overflow branch September 28, 2022 03:19
@primer-css primer-css mentioned this pull request Sep 28, 2022
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.

5 participants