cioraneanu / firefly-pico

A delightful Firefly III companion web app for effortless transaction tracking
GNU Affero General Public License v3.0
391 stars 15 forks source link

Android Back Button Behavior - Requires Multiple Presses to Exit When Switching Tabs #101

Open e-labInnovations opened 1 week ago

e-labInnovations commented 1 week ago

When using Firefly-Pico as a PWA on Android, switching between the bottom tabs (e.g., Home, Add, Transactions, Settings, etc.) causes the back button to behave unexpectedly. Specifically, after switching tabs, pressing the Android back button requires multiple presses to exit the application. The number of presses needed corresponds to how many times the user has switched tabs.

Expected Behavior:

When switching between tabs, the Android back button should not step back through each tab change. Instead, it should either:

  1. Exit the application if the user is on a main tab, or

  2. Navigate within the current tab if the user has drilled down into a deeper page (e.g., viewing a transaction detail).

Steps to Reproduce:

  1. Open Firefly-Pico as a PWA on an Android device.

  2. Switch between the bottom tabs (e.g., Home -> Add -> All Transactions).

  3. Press the Android back button.

  4. Notice that the back button steps back through each tab change, requiring multiple presses to exit the application.

Proposed Solution:

Implement a custom back button handler to:

  1. Prevent tab switches from being added to the browser history stack.

  2. Make the back button behave like a native app—exiting the application when on a main tab, or navigating back only within a single tab's deeper navigation flow.

cioraneanu commented 1 week ago

Thank you for your suggestion 👍 Adding it as something nice to have later down the road, since not everyone uses Android and not everyone uses the PWA version.

If you find this valuable you can try to submit a PR