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

feat(react): add horizontal overflow to Tabs in v11 #10799

Merged
merged 28 commits into from
Mar 2, 2022
Merged

feat(react): add horizontal overflow to Tabs in v11 #10799

merged 28 commits into from
Mar 2, 2022

Conversation

abbeyhrt
Copy link
Contributor

Closes #10249

This was a doozy.

  • Adds horizontal overflow to Tabs.
  • Adds a hook usePressable. By default, the events are called in this order: onMouseDown -> onMouseUp -> onClick. Because of this, usePressable coordinates when onClick, onMouseDown, and onMouseUp are called so that onMouseDown isn't called when a user just clicks and that, if a user has been pressing and holding onMouseDown, onClick isn't called after it's released.
  • handles window resize to add horizontal overflow buttons when necessary.
  • adjust styles for overflow buttons

Testing / Reviewing

Go to the Tabs stories in next storybook and try out the horizontal overflow, holding press and just clicking. The first story has been changed to be in a small container so you can mess around with it (I'll remove before merging).
With the other stories, test out that the overflow updates appropriately on resize.

@abbeyhrt abbeyhrt requested a review from a team as a code owner February 18, 2022 22:55
@netlify
Copy link

netlify bot commented Feb 19, 2022

✔️ Deploy Preview for carbon-react-next ready!

🔨 Explore the source changes: bb8932c

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-react-next/deploys/621fd0c39915b50008c4565a

😎 Browse the preview: https://deploy-preview-10799--carbon-react-next.netlify.app

@netlify
Copy link

netlify bot commented Feb 19, 2022

✔️ Deploy Preview for carbon-elements ready!

🔨 Explore the source changes: bb8932c

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-elements/deploys/621fd0c3a2449500074260fe

😎 Browse the preview: https://deploy-preview-10799--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Feb 19, 2022

✔️ Deploy Preview for carbon-components-react ready!

🔨 Explore the source changes: bb8932c

🔍 Inspect the deploy log: https://app.netlify.com/sites/carbon-components-react/deploys/621fd0c344bc4a00086ae45f

😎 Browse the preview: https://deploy-preview-10799--carbon-components-react.netlify.app

@abbeyhrt abbeyhrt requested a review from a team as a code owner February 21, 2022 21:50
@abbeyhrt abbeyhrt requested review from laurenmrice and removed request for laurenmrice February 24, 2022 19:13
Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Could we call scrollIntoView on a tab when it's selected? Selecting "Tab 5" here leaves it out of view.

selected.doesnt.scroll.into.view.mov

Otherwise looks solid to me!

@aledavila
Copy link
Contributor

I think I broke it. When I press and hold to the end I can't go back to the left no matter what I click

Screen.Recording.2022-03-02.at.1.57.55.AM.mov

@abbeyhrt
Copy link
Contributor Author

abbeyhrt commented Mar 2, 2022

@aledavila Yeah it was :/ that should be fixed now if you want to check it out!

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Yes! Looks great 🚀

@kodiakhq kodiakhq bot merged commit fd03157 into carbon-design-system:main Mar 2, 2022
tay1orjones added a commit to tay1orjones/carbon that referenced this pull request Mar 3, 2022
…stem#10799)

* chore: check in progress

* chore: check in progress

* chore: check in progress

* chore: check in progress

* chore: check in progress

* feat(react): add horizontal overflow to tabs

* fix(react): adjust styles

* feat(react): add horizontal overflow to tabs

* chore(react): remove extraneous changes

* chore(react): remove extraneous changes

* fix(react): update snapshots and failing test

* fix(react): replace use layout with use isomorphic

* fix(react): fix incorrect import

* fix(react): scroll tab into view when clicked

* fix(react): scroll tab into view when clicked

* feat(tabs): update scroll position on click

* fix(tabs): update usePressable and fix interop with long press

* fix(tabs): update animation mechanism and fix safari text selection issue

* fix(tabs): add will-change: scroll-position

* chore(tabs): remove extra comments on usePressable

* fix(react): adjust next button visible and remove transparent keyowrd

Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com>
Co-authored-by: Josh Black <josh@josh.black>
@tay1orjones tay1orjones mentioned this pull request Mar 3, 2022
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.

[Tabs]: reimplement horizontal scrolling in /next version
4 participants