Skip to content

feat: open the menu with a swipe from the left - #775

Closed
arthur-lzrs wants to merge 1 commit into
joszz:mainfrom
arthur-lzrs:feat/edge-swipe-menu
Closed

arthur-lzrs wants to merge 1 commit into
joszz:mainfrom
arthur-lzrs:feat/edge-swipe-menu

Conversation

@arthur-lzrs

Copy link
Copy Markdown
Contributor

Summary

On a phone the menu opens only from its button in the top bar, which is a stretch for a thumb on a large screen.

A new device setting, Settings > General > This device > Swipe from the edge for the menu, lets a swipe to the right that starts a little in from the left edge open the menu, and a swipe to the left on the menu or its backdrop close it.

  • Off by default, kept per device (like keeping the screen on), and offered only on a phone-sized screen with a touchscreen. A narrow desktop window has no finger to swipe with, and a tablet has a sidebar.
  • It starts 30 to 84 px in from the edge, never at it. A phone's own back gesture (iOS and Android) takes the very edge and a page cannot stop it, so starting clear of it means the two are never started by the same touch. The band is wide enough (54 px) to hit with a thumb without aiming.
  • It leaves alone what already moves under the finger: the two map pages (a map pans on any touch), anything over a dialog, a map, a chart, and any row that scrolls sideways. A finger that moves up or down first is a scroll.
  • With the setting off, or on a screen that does not offer it, nothing changes.

How it works

  • useDrawerSwipe (new composable) listens on the window, so nothing sits over the page to catch taps meant for it. It is a decision, not a drag: once the finger has gone 56 px sideways, and not mostly up or down, the menu opens as it does for its button.
  • It follows pointer events, plus touch events: Chrome on Android takes a sideways drag for a pan after a few pixels and cancels the pointer, so the touch events carry the drag on from there.
  • App.vue wires it to the existing menu state. DeviceSettings.vue has the toggle.
  • edgeSwipeMenu is in the UI settings and listed in localKeys, so it stays on the device and is not synced to the account.

Type of Change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • Dependency update
  • Other

Related Issues

None.

How it was tested

  • Unit tests for the composable (the band and its edges, the distance and direction thresholds, scrolling, a second finger, a gesture that is cancelled, the guards for modals, maps and sideways scrollers, the touch-event path), for the wiring in App.vue, for the toggle, and for the setting staying on the device (parse and sync).
  • On a real iPhone: the menu opens and closes with the swipe, and the system back gesture at the very edge is no longer mixed up with it.
  • Not tried on a real Android phone: the touch-event fallback is there for the pointer being cancelled by Chrome, and is covered by unit tests only.

Notes for review

  • The band (30 to 84 px) is two constants at the top of useDrawerSwipe.ts, EDGE_START_MIN_PX and EDGE_START_MAX_PX. Some Android gesture-navigation settings widen the system back zone; the floor is a default that is easy to move.
  • Translations: the strings in nl, es and pt-PT are my own drafts, so a native check is welcome.
  • Merging with a sibling PR: the layout editor's size buttons PR also adds a device-local UI setting, so both touch settingsUi.ts, settingsStores.spec.ts and settingsSync.spec.ts next to the same lines. Whichever lands second needs a trivial rebase.

Checklist

  • Tests added or updated
  • Checks pass: pnpm check in frontend/ (frontend only: the .NET side is untouched, so dotnet test and dotnet format were not run)
  • Commit messages follow Conventional Commits (feat: ..., fix(frontend): ...)
  • If trips changed (ITripRepository): done in the demo too, with a step in TripRepositoryContractTests (not applicable)
  • If the API changed: the rewritten documentation/openapi.json is committed (not applicable, the API did not change)
  • New fields or features have demo data in src/GarageStack.Data/Demo/ (not applicable, nothing here needs data)
  • No secrets or personal data committed, and no real VIN or licence plate in test data
  • Responsive on mobile, down to 320 px wide (the swipe itself is for a phone; the setting's row wraps like the other toggles)
  • Every new UI text is an i18n key, in every file in frontend/src/locales/
  • If unraid/garagestack.xml changed: synced to joszz/unraid-community-apps after merge (not applicable, it did not change)

🤖 Generated with Claude Code

On a phone the menu opens only from its button in the top bar, which is a stretch for a thumb
on a large screen.

A new device setting, Settings > General > This device > "Swipe from the edge for the menu",
lets a swipe to the right that starts a little in from the left edge open the menu, and a
swipe to the left on the menu or its backdrop close it. It is off by default, kept per device
like keeping the screen on, and offered on a phone-sized screen with a touchscreen.

The swipe starts 30 to 84 px in from the edge and never at it: a phone's own back gesture
takes the very edge and a page cannot stop it, so starting clear of it means the two are never
started by the same touch. It is not started on the map pages (a map pans on any touch), over
a dialog, or on a map, a chart or anything that scrolls sideways. A finger that moves up or
down first is a scroll and is left alone.

The gesture listens on the window (pointer events, with touch events to follow the drag where
a browser cancels the pointer to pan the page), so nothing sits over the page to catch taps.
useDrawerSwipe holds it, App.vue wires it to the menu, and DeviceSettings has the toggle. The
new edgeSwipeMenu setting is local to the device, so it is not synced to the account.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@joszz

joszz commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thanks a lot for this, and for all the PRs you've opened! I'm going through them one by one, and I started with the ones that, as a web developer, I had the most doubts about. This is one of them, so I'm closing it. Here's why:

  • It can't promise it won't clash with the back gesture. The swipe starts in a band 30 to 84 px from the edge, but the phone's back zone isn't a fixed width. On Android the user sets the back-gesture sensitivity, and it differs between brands, so on the higher settings part of that band is the back gesture again. iOS Safari in a normal tab has its own swipe from the edge to go back too.
  • A near miss is costly. If a thumb lands a few px too close to the edge, the phone goes back. In the installed app that can leave the page or close the app. Missing the menu button costs nothing; missing this band throws you out.
  • It's hard to discover. It's off by default, under Settings > General > This device, and even then you have to know to start in an invisible band a little in from the edge. Most people swipe from the very edge, which is the part that belongs to the OS.
  • It's a trigger, not a drag. The menu opens all at once after 56 px instead of following the finger, so it would feel different from the swipe drawers people know from apps.

Native Android moved away from edge-swipe drawers once gesture navigation came in, for these same reasons, so I'd rather not go there.

The problem you're solving is real though: the menu button in the top left is hard to reach with a thumb. If you'd like to have a go at that, I'd welcome a fix that needs no gestures, for example a bottom navigation bar on phones with a "More" item that opens the full menu, or a menu button at the bottom of the screen. Happy to talk it through in an issue first.

Your other PRs look a lot more promising, and I'll get to them next. Thanks again for putting the time in!

@joszz joszz closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants