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(<DraggableTabs>): Add new draggable tabs component to storybook #73239

Merged
merged 17 commits into from
Jun 28, 2024

Conversation

MichaelSun48
Copy link
Member

@MichaelSun48 MichaelSun48 commented Jun 24, 2024

Note: This PR merges into the msun/draggableTabsComponent, not master. The msun/draggableTabsComponent branch contains the components/draggableTabs directory with with the files from components/tabs (except for the test file). This is so that the diff for this PR is easier to read and more intuitive – it effectively shows all upgrades to the existing tabs components to make the tabs draggable.

This PR implements an MVP for drag and drop tabs. Visually, these tabs are identical to the current tabs component, but you can drag them and drop them within the TabList, and a vertical line appears to indicate the drop position for a tab that is currently being dragged. You can play around with this component in the vercel deployment's storybook.

Quick Demo:

Screen.Recording.2024-06-25.at.2.15.21.PM.mov

Known issues:

  • Tabs seem to not drag unless you focus on them first
  • The drop indicator seems to stutter between the first and second positions sometimes (visible in the screen recording above)

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 24, 2024
@MichaelSun48 MichaelSun48 changed the base branch from master to msun/draggableTabsComponent June 25, 2024 17:20
Copy link

codecov bot commented Jun 25, 2024

Bundle Report

Changes will increase total bundle size by 171.96kB ⬆️

Bundle name Size Change
app-webpack-bundle-array-push 27.46MB 171.96kB ⬆️

@scttcper
Copy link
Member

dragging an item onto itself seems to move it to the next position

CleanShot.2024-06-25.at.17.06.39.mp4

@scttcper
Copy link
Member

feels like the draggable element is hijacking the click to switch tabs

CleanShot.2024-06-25.at.17.11.52.mp4

@MichaelSun48
Copy link
Member Author

MichaelSun48 commented Jun 26, 2024

dragging an item onto itself seems to move it to the next position

Fixed in the latest commits, thanks for catching this!

@MichaelSun48
Copy link
Member Author

MichaelSun48 commented Jun 26, 2024

feels like the draggable element is hijacking the click to switch tabs

This is still broken - working on a fix Fixed

Copy link
Member

@malwilley malwilley left a comment

Choose a reason for hiding this comment

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

Looks like a good start! We can improve on the drag interactions in subsequent PRs, but before merging this one I'd like to try a couple things:

  • Add a test file with some basic tests (similar to the original tabs component). Ideally we would want a test that validates the drag and drop is working correctly, but that may be difficult with the jsdom test env. You can try something like this https://testing-library.com/docs/user-event/pointer and see if that works though.
  • Ideally we would want to use some of the Tab components directly instead of copy/pasting them. I'd give that a shot and at least uncover what kind of issues you run in to and note them down so that we can tackle the code deduplication later on.

@MichaelSun48 MichaelSun48 merged commit 8ad43da into msun/draggableTabsComponent Jun 28, 2024
36 checks passed
@MichaelSun48 MichaelSun48 deleted the msun/draggableTabs branch June 28, 2024 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Views: MVP for dnd tabs component
3 participants