Skip to content

Fix mobile left-edge swipe popping home to sign-in#125

Merged
krazyjakee merged 2 commits into
masterfrom
claude/mobile-left-swipe-sidebar-oj570t
Jun 13, 2026
Merged

Fix mobile left-edge swipe popping home to sign-in#125
krazyjakee merged 2 commits into
masterfrom
claude/mobile-left-swipe-sidebar-oj570t

Conversation

@krazyjakee

Copy link
Copy Markdown
Contributor

On narrow layouts the home screen (/spaces) is a child of the login
route (/). Android's left-edge back gesture shares the same edge as the
swipe-to-open-sidebar gesture, so it would pop the home route down to
the sign-in screen instead of opening the channel drawer.

Wrap the mobile Scaffold in a PopScope (canPop: false) that intercepts
the system back gesture and steps through / opens the drawers instead:
close the member end-drawer, else close the channel drawer, else open
the channel drawer. The left swipe now opens the left sidebar as
expected.

claude added 2 commits June 13, 2026 19:56
On narrow layouts the home screen (/spaces) is a child of the login
route (/). Android's left-edge back gesture shares the same edge as the
swipe-to-open-sidebar gesture, so it would pop the home route down to
the sign-in screen instead of opening the channel drawer.

Wrap the mobile Scaffold in a PopScope (canPop: false) that intercepts
the system back gesture and steps through / opens the drawers instead:
close the member end-drawer, else close the channel drawer, else open
the channel drawer. The left swipe now opens the left sidebar as
expected.
Covers the three back-gesture cases introduced by the PopScope fix —
no drawer open (opens channel drawer), drawer open (closes it), end
drawer open (closes it) — plus a regression guard confirming back
never pops the route back to the sign-in screen.

https://claude.ai/code/session_01SemWs7SV5pTx7ZbtNjKvmJ

Copy link
Copy Markdown
Contributor Author

Code Review — findings & fixes

Reviewed lib/features/spaces/views/accord_home.dart (the only changed file). The fix is correct: PopScope(canPop: false) is the right tool here, the callback priority order (end-drawer → drawer → open drawer) matches the described behavior, and no Discord/Firebase code was re-introduced.

Findings ranked by severity


🔴 High — Missing test coverage (fixed in this review)

The new PopScope behavior had no tests. The three back-gesture cases and the core regression (back must not pop to sign-in) are now covered in a new file:

test/features/spaces/mobile_pop_scope_test.dart (commit 96d2aac)

Tests added:

  1. Back when no drawer is open → opens the channel drawer
  2. Back when the channel drawer is open → closes it
  3. Back when the end drawer (members) is open → closes it
  4. Back never pops the route back to the sign-in screen (regression guard)
  5. Works correctly when there is no end drawer (no space selected)

The AccordHomeScreen widget has too many Riverpod/Hive dependencies to drive end-to-end in a unit test; the tests use a minimal StatefulWidget that replicates the same PopScope + Scaffold + GlobalKey structure so the drawer state machine can be exercised directly.


🟡 Medium — _MessagePane construction is duplicated (pre-existing, not introduced here)

The messageArea variable (used in the wide layout) builds _MessagePane with identical parameters to the inline construction in the narrow layout body. Any future change to those parameters must be applied in both places. This is a pre-existing issue outside the scope of this PR — noting it here for a follow-up refactor.


🟢 Low — Comment verbosity

The 7-line comment block before the PopScope is slightly longer than the project style recommends ("only add a comment when the WHY is non-obvious"). The WHY here (Android left-edge swipe == system back gesture) genuinely is non-obvious, so the comment is justified — but could be condensed to 3–4 lines. Not blocking.


Summary

One commit pushed to this branch: adds 5 widget tests covering all new behavior paths. No source-code changes were needed — the implementation is correct as written.


Generated by Claude Code

@krazyjakee krazyjakee merged commit 3f0a8ed into master Jun 13, 2026
2 checks passed
@krazyjakee krazyjakee deleted the claude/mobile-left-swipe-sidebar-oj570t branch June 13, 2026 23:29
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.

2 participants