feat: controlled activeId prop and optional haptics - #4
Merged
Conversation
- activeId: pass the active tab's id on <MobileTabBar> and it derives each tab's active state internally, so consumers can drop the per-tab isActive booleans. isActive is now optional and still honored when activeId is omitted, so existing usage is unchanged. - haptics: opt-in navigator.vibrate(10) on tap (links and action tabs), guarded for platforms without the Vibration API; navigation still proceeds for links. - Tests for both; README documents the props and the now-optional isActive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCE1RpZpzupe5kvo5aGGvV
NagyVikt
marked this pull request as ready for review
June 22, 2026 10:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second follow-up PR — backward-compatible API ergonomics (#7, #9).
activeId(#7)Pass the active tab's
idonce on<MobileTabBar activeId={...}>and each tab's active state is derived internally (tab.id === activeId), so consumers can drop the per-tabisActivebooleans.isActiveis now optional and still honored whenactiveIdis omitted — existing usage is unchanged.haptics(#9)Opt-in
hapticsprop firesnavigator.vibrate(10)on tap for both links and action tabs, guarded for platforms without the Vibration API (no-op on iOS Safari). For links it does notpreventDefault, so navigation still happens.Tests
activeIdselects the active tab and overrides per-tabisActive; also works with noisActiveon any tab.navigator.vibrateis stubbed → called with10on tap only whenhapticsis set; the tab's ownonClickstill fires.12 tests total now pass.
Verification
npm run type-check,npm run build,npm testall green locally. README updated (API table,activeId/hapticssections,isActivemarked optional).🤖 Generated with Claude Code
https://claude.ai/code/session_01WCE1RpZpzupe5kvo5aGGvV
Generated by Claude Code