fix(mobile): swipe-down on comments drawer no longer closes now-playing#14443
Merged
Conversation
The CommentDrawerContext's `close` callback was dispatching
`closeNowPlayingDrawer()` whenever the now-playing drawer was open —
intended for the "user clicked a UserLink inside a comment" flow, per
the existing comment. But `close` is also what
`BottomSheetModal.onDismiss` calls when the user swipes the comments
sheet down (and what the X button in `CommentDrawerHeader` calls).
Result: swiping down on the comments drawer dismissed the now-playing
drawer underneath it.
Split the close behavior:
- `close(trackId)` — closes the comment drawer only. This is what the
swipe-down (`onDismiss`) and the X button route through.
- `closeAndExitNowPlaying(trackId)` — closes the comment drawer AND
any open now-playing drawer. Used for in-drawer navigation actions
(profile-pic tap, user-link tap, mention tap inside `CommentText`)
so the destination screen is actually visible when the navigation
push lands; if we left now-playing open the user would just see the
player on top of the new screen.
CommentBlock now derives `handleNavigateAway = () =>
closeAndExitNowPlaying(track.track_id)` and routes its three navigation
sites (profile pic, UserLink, CommentText's onCloseDrawer for mention
clicks) through it. The section-context's `closeDrawer` callback isn't
read in CommentBlock anymore.
Note the existing `gesturesDisabled={isCommentDrawerOpen}` on the
underlying Drawer in `NowPlayingDrawer.tsx` was already doing its job —
it prevents the swipe from reaching the now-playing drawer's
PanResponder. The bug was purely the explicit programmatic
`closeNowPlayingDrawer()` call inside `close`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
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.
The bug
Open the now-playing drawer, open the comments drawer inside it, swipe the comments drawer down — the now-playing drawer slides closed too. Only the comments drawer should dismiss.
Why it was happening
CommentDrawerContext.closewas unconditionally dispatchingcloseNowPlayingDrawer()whenever the now-playing drawer was open, with the existing comment hand-waving that this was for "click on a UserLink inside the comments drawer":But
closeis also exactly whatBottomSheetModal.onDismissroutes through when the sheet is swiped down (or backdrop-tapped, or X-button-closed). So every dismiss path went through the same now-playing close.The existing
gesturesDisabled={isCommentDrawerOpen}on the underlyingDrawerinsideNowPlayingDrawer.tsxwas actually doing its job — it prevents the swipe gesture from reaching the now-playing drawer's PanResponder. The bug was purely the explicit programmaticcloseNowPlayingDrawer()call insidecloserunning on every dismiss.Fix
Split the close behavior in
CommentDrawerContextso dismiss flows don't drag now-playing along, and navigation flows still do:Then
CommentBlock.tsxroutes its three navigation sites through the new method via a smallhandleNavigateAwayderived fromtrack.track_id:handlePressProfilePic)<UserLink onPress=…>)<CommentText onCloseDrawer=…>mention-tap pathThe section context's
closeDrawercallback isn't read inCommentBlockanymore. The X button inCommentDrawerHeaderand theonDismisson the bottom sheet both still callclose(entityId)→ comment drawer dismisses, now-playing stays open. ✅Files
packages/mobile/src/components/comments/CommentDrawerContext.tsx— split intocloseandcloseAndExitNowPlayingpackages/mobile/src/components/comments/CommentBlock.tsx— route navigation handlers throughhandleNavigateAwayNet diff: +47 / −9.
Verification
tsc --noEmitclean inpackages/mobile@mentioninside a comment. Both drawers should close, navigation to the user's profile.🤖 Generated with Claude Code