feat(Tabs): add drag-to-scroll for horizontal tabs (DS-4765)#423
Conversation
|
Visit the preview URL for this PR (updated for commit 6adca96): https://react-koobiq-next--prs-423-1fc3e15q.web.app (expires Mon, 20 Jul 2026 17:59:07 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: fc29847d4a9e5cb1adf458c76a9b681c76e2eeff |
There was a problem hiding this comment.
Pull request overview
This PR adds mouse drag-to-scroll (with inertia) for horizontally overflowed Tabs, improving usability when many tabs don’t fit in the viewport while preserving native touch scrolling behavior.
Changes:
- Introduces a
useDragScrollhook to implement mouse drag scrolling with momentum and click suppression during drags. - Wires drag-scroll behavior into
Tabsscroll container and exposesdata-draggingfor styling. - Updates
Tabselection behavior under horizontal overflow (shouldSelectOnPressUp) and adds unit tests covering drag, selection suppression, and inertia.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/components/src/components/Tabs/Tabs.tsx | Integrates drag-to-scroll into the tabs scroll box, cancels inertia on programmatic scroll, and adjusts tab press selection behavior when overflowed. |
| packages/components/src/components/Tabs/Tabs.test.tsx | Adds test helpers and coverage for mouse-drag scrolling, non-drag cases, selection suppression during drags, and inertia behavior. |
| packages/components/src/components/Tabs/Tabs.module.css | Adds grab/grabbing cursor styling and disables selection while dragging when horizontally scrollable. |
| packages/components/src/components/Tabs/hooks/useDragScroll.ts | New hook implementing mouse-only drag-to-scroll with inertia and click suppression. |
| packages/components/src/components/Tabs/hooks/index.ts | Exports the new useDragScroll hook. |
| packages/components/src/components/Tabs/components/Tab/Tab.tsx | Adds shouldSelectOnPressUp support and forwards it into useTab. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Круто) Давай инерцию добавим на драг-скролл |
|
Я смотрел пример editable и там не было инерции при скролле |

No description provided.