Skip to content

Add swipe gestures for mobile tabs (#219) - #268

Merged
arisu6804 merged 1 commit into
RemitFlow:mainfrom
Hollujay:feat/219-add-swipe-gestures-mobile-tabs
Jul 24, 2026
Merged

Add swipe gestures for mobile tabs (#219)#268
arisu6804 merged 1 commit into
RemitFlow:mainfrom
Hollujay:feat/219-add-swipe-gestures-mobile-tabs

Conversation

@Hollujay

@Hollujay Hollujay commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a reusable Tabs component with swipe gesture support for mobile devices. Users can now swipe left/right on touch screens to navigate between tab panels, while desktop users continue to click tab headers as before.

Motivation

Mobile users on narrow viewports need a native-feeling tab navigation experience. Swipe gestures provide intuitive, fast tab switching that matches platform conventions on iOS and Android.

Changes Made

New Files

  • src/components/Tabs.jsx — Tab component with:

    • Touch swipe tracking (touchstart/touchmove/touchend with live translate during drag)
    • 50px swipe threshold before activating adjacent tab
    • Controlled (activeIndex prop) and uncontrolled modes
    • Click-to-switch on desktop via tab header buttons
    • Full ARIA tablist / tab / tabpanel roles, aria-selected, aria-controls, aria-labelledby
    • Proper keyboard tabIndex management
  • src/components/Tabs.css — Dark-theme styles with:

    • Sliding indicator bar using CSS transform
    • Smooth transitions on tab switch
    • prefers-contrast: more/less media query support
    • Minimum 44×44px touch targets on tab headers (WCAG 2.5.5)
  • test/components/Tabs.test.jsx — 15 tests covering:

    • Rendering all tab labels and default active state
    • Click-to-switch on desktop
    • aria-selected updates
    • onChange callback invocation
    • Controlled activeIndex via rerender
    • No-op when same tab is clicked
    • Swipe left to go next, swipe right to go previous
    • Boundary behavior (no swipe past first/last tab)
    • Sub-threshold swipe (no activation below 50px)
    • Accessible ARIA markup (ids, controls, labelledby)
    • Empty tabs array and custom className
  • src/components/Tabs.stories.jsx — Storybook stories (default, two-tabs, controlled)

Modified Files

  • README.md — Added Tabs to features list, project structure, and a new Tabs Component documentation section with usage example.

Testing

  • All 15 new component tests pass
  • Full test suite: existing failures are pre-existing (timeouts in integration/wallet tests, unrelated to this change)
  • Storybook stories render correctly (default, two-tab, controlled variants)

Checklist

  • Tests pass locally
  • Code follows project style guidelines
  • Documentation updated
  • No breaking changes

Closes #219

Add a reusable Tabs component with touch swipe gesture support for
mobile devices. Features click-to-switch on desktop and swipe left/right
on touch devices with a 50px threshold.

- Swipe tracking with live translate transform during touch move
- Controlled and uncontrolled modes via activeIndex prop
- Full ARIA compliance (tablist, tab, tabpanel roles)
- Storybook stories for documentation
- 15 unit tests covering swipe, click, controlled mode, accessibility
- Dark theme support with prefers-contrast media queries
@arisu6804

Copy link
Copy Markdown
Contributor

Nice contribution! 🌟

@arisu6804
arisu6804 merged commit b351b26 into RemitFlow:main Jul 24, 2026
1 check passed
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.

Add swipe gestures for mobile tabs

2 participants