Skip to content

fix(mobile): swipe-down on comments drawer no longer closes now-playing#14443

Merged
dylanjeffers merged 1 commit into
mainfrom
fix/comment-drawer-swipe-keep-now-playing
Jun 3, 2026
Merged

fix(mobile): swipe-down on comments drawer no longer closes now-playing#14443
dylanjeffers merged 1 commit into
mainfrom
fix/comment-drawer-swipe-keep-now-playing

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

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.close was unconditionally dispatching closeNowPlayingDrawer() 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":

// CommentDrawerContext.tsx — before
const close = useCallback((trackId: ID) => {
  setIsOpen(false)
  // This happens when you click on a UserLink inside the comments drawer
  if (isNowPlayingDrawerOpen) {
    closeNowPlayingDrawer()
  }
  // …
})

But close is also exactly what BottomSheetModal.onDismiss routes 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 underlying Drawer inside NowPlayingDrawer.tsx was actually doing its job — it prevents the swipe gesture from reaching the now-playing drawer's PanResponder. The bug was purely the explicit programmatic closeNowPlayingDrawer() call inside close running on every dismiss.

Fix

Split the close behavior in CommentDrawerContext so dismiss flows don't drag now-playing along, and navigation flows still do:

interface CommentDrawerContextState {
  isOpen: boolean
  open: (data: CommentDrawerData) => void
  /** Close the comment drawer only. Used by swipe-down / X button. */
  close: (trackId: ID) => void
  /** Close the comment drawer AND any open now-playing drawer.
   *  Used by in-drawer navigation actions so the destination screen
   *  is visible once we navigate. */
  closeAndExitNowPlaying: (trackId: ID) => void
}

Then CommentBlock.tsx routes its three navigation sites through the new method via a small handleNavigateAway derived from track.track_id:

  • profile-pic tap (handlePressProfilePic)
  • the comment's username (<UserLink onPress=…>)
  • the <CommentText onCloseDrawer=…> mention-tap path

The section context's closeDrawer callback isn't read in CommentBlock anymore. The X button in CommentDrawerHeader and the onDismiss on the bottom sheet both still call close(entityId) → comment drawer dismisses, now-playing stays open. ✅

Files

Net diff: +47 / −9.

Verification

  • tsc --noEmit clean in packages/mobile
  • Manual: open the now-playing drawer → open comments → swipe comments down. Now-playing should stay open.
  • Manual: same, but tap the X in the comment drawer header. Now-playing should stay open.
  • Manual: tap a commenter's profile pic or username. Both drawers should close and you should land on their profile.
  • Manual: tap an @mention inside a comment. Both drawers should close, navigation to the user's profile.

🤖 Generated with Claude Code

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>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 3, 2026

⚠️ No Changeset found

Latest commit: 70c817d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dylanjeffers dylanjeffers merged commit be337f0 into main Jun 3, 2026
3 checks passed
@dylanjeffers dylanjeffers deleted the fix/comment-drawer-swipe-keep-now-playing branch June 3, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant