Skip to content

Back Navigation

Back returns to where you came from, but skips pages at the same level as this one or lower. Settings is lower than every other page.

Every Back button of the app follows this one rule: the Back in the top bar, and the Back of the household sidebar on desktop. The few Backs that do something else are listed at the end of this page.


Page levels

Every page has a level. Level 1 is the top. A smaller number is a higher page.

LevelPagesExample
1Pantry, Shopping, CookingPantry
2a vendor’s cartthe Costco cart
3an item page, any tabMilk, Tags tab
4the settings menu (mobile only; it has no Back of its own)Settings
5a settings section page: General, Members, Activity, and the Locations, Tags, Vendors, Recipes and Shelves listsSettings › Tags
6one location, tag, vendor, recipe or shelf, any tabthe tag “Dairy”, Items tab

Settings is lower than every other page, because entering settings feels like going deep into how the household is set up. Inside settings, the menu is above the lists, and the lists are above one row.

Sign-in, sign-up, joining a household and onboarding have no level. They are never a Back target.


The rule

When the user presses Back:

  1. All tabs of one thing are one page. All tabs of one item, or of one tag, vendor, recipe, shelf or location, count as one page. So Back never stops on another tab of the same thing.
  2. Look at the page the user came from: the opener. If the opener is higher than this page, go there. If it is lower, go there too. “Lower” is the exception: an item opened from a tag’s Items tab returns to that tag.
  3. If the opener is at the same level, skip it. For example: the Tags list, then the Vendors list. Back from the Vendors list does not go to the Tags list.
  4. Keep going back. Skip every page at the same level or lower. Stop at the first higher page.
  5. Nothing found: go to the page’s fixed fallback.
Back fromFallback
an item pagePantry
one tag, vendor, recipe or shelfits list (for example Settings › Tags)
one locationSettings › Locations
a settings section page, on mobilethe settings menu
the household sidebar (desktop)Pantry
a vendor’s cartShopping, sorted by most recent

Pantry, Shopping and Cooking are at the top, so they have no Back. The settings menu has no Back either: on a phone it is one of the four bottom bar tabs, so the bottom bar is the way out.

Unsaved changes. On an item page or a settings row with unsaved changes, Back first opens the Unsaved changes dialog. The user saves or discards. Only then does Back go anywhere. The same happens after a Save or a Delete that leaves the page: the app then goes Back by this rule.


Back forgets the way it came

After Back, the app forgets every page after the target. So the next Back cannot return to the page the user just left. Without this, the user could go round in a circle: item → settings → item → settings.

The browser’s own Back button, and the phone’s Back gesture or button, work the same way. They also make the app forget the pages after the one they land on.

Example:

  1. Pantry → Milk → Manage tags → Settings › Tags.
  2. The user presses the phone’s Back. They are on Milk again.
  3. The user presses the app’s Back on Milk. They go to Pantry, not to the Tags list.

When Back finds no target and goes to the fallback, the app forgets the whole way. The fallback page starts a new history.

One case the rule does not fix (accepted by the owner). Pantry → Milk → Settings › Tags, then the app’s Back (to Milk), then the browser’s Back. The browser shows the Tags list again. The app’s Back there now goes to Pantry, not to Milk. For the browser, Milk is “forward” at that point, and the app has already forgotten it.


Examples

The way the user tookBack from the last page goes to
Pantry → Milk, Tags tab → Manage tags → Settings › TagsMilk, Tags tab. Then Pantry
Pantry → Milk → Manage tags → Settings › Tags → the tag “Dairy”Settings › Tags. Then Milk. Then Pantry
a cart → Milkthe cart (it is higher than the item)
Pantry → Milk → Manage tags → Settings › Tags → Settings › Vendors (desktop sidebar)Milk. The Tags list is at the same level, so it is skipped
Shopping → the settings menu (mobile) → Settings › Tagsthe settings menu. It has no Back: the user leaves it with the bottom bar
Pantry → Settings › Tags → the tag “Dairy” → its Items tab → Milkthe tag “Dairy” (the opener is lower: the exception). Then the Tags list. Then Pantry
a link opened straight into the tag “Dairy”, no way before itSettings › Tags (the fallback)
Pantry → Settings › General → Settings › Locations → the location “Home”Settings › Locations. Then Pantry: General is at the same level as the list, so it is skipped
Shopping sorted by name → the Costco cartShopping, still sorted by name
a link opened straight into a cartShopping, sorted by most recent (the fallback)
desktop: Settings › Tags → the tag “Dairy” → Settings › Vendors (sidebar)the tag “Dairy”. It is the opener and it is lower, so the exception applies. Kept on purpose for now; we will look at it again after user feedback

Mobile and desktop

The rule is the same on both. Only the place of the Back button differs.

PageMobileDesktop
an item page, or one location, tag, vendor, recipe or shelfthe Back in the top barthe Back in the top bar
a settings section page (General, Members, Activity, a list)the Back in its own top barthe Back at the top of the household sidebar. The page has no Back of its own
the settings menuno Back: it is a bottom bar tab page(no menu page: Settings opens General directly)
a vendor’s cartthe Back in the top barthe Back in the top bar

On desktop the household sidebar links one list to another. So on desktop the user can move from list to list, and Back skips those lists (rule step 3).

A page with a Back button has no bottom bar on a phone

On a phone, a page with a Back button in its top bar has no bottom navigation bar. The Back button is the way out, and the list gets the whole screen height. On desktop the sidebar follows its own rule, which does not change.

The four bottom bar tab pages show the bottom bar and have no Back button on a phone: Pantry (/), Shopping (/shopping), Cooking (/cooking) and the settings menu (/settings). The bottom bar shows which tab is open.

PagePhone: bottom barDesktop: sidebar
Pantry, Shopping, Cooking, and the Pantry lists of shelves, vendors and recipesshownshown
the settings menu (/settings)shown, with the Settings tab active(no menu page: Settings opens General)
a vendor’s carthiddenshown
a shelf, vendor or recipe view in Pantry (its Go back opens the Pantry list)hiddenshown
an item pagehiddenhidden
every settings section pagehiddenshown (the household sidebar)
one location, tag, vendor, recipe or shelfhiddenhidden

The views in Pantry count too, though their Go back does not follow the Back rule above: what matters is the Back button in the top bar.

When you add a page with a Back button in its top bar, add it to isFullscreenPage in apps/web/src/lib/layoutRules.ts. That one function decides when the bottom bar and the sidebar are hidden. A full-screen page must have its own <h1>: the layout adds its hidden app-name heading only on pages with the bottom bar. The settings menu is the one page with the bottom bar AND its own visible <h1> (its title); the layout adds no hidden heading there (isSettingsRootPage).


Backs that do not follow this rule

These buttons go “back” in some way, but they do not leave the page by the rule. Each one has a reason.

ButtonWhat it doesWhy it stays
Go back in the pantry’s recipe, shelf and vendor viewsreturns to the pantry’s list of recipes, shelves or vendorsit is a view inside Pantry. The page stays Pantry
Back in the onboarding stepsshows the previous stepthe steps are inside one page
Back in the user panel of the sidebarcloses the panel and shows the main sidebarit does not go to another page
Back to the household on the Activity page, when the user may not see the activityopens Settings › Generala fixed link on an error screen. General is at the same level, so the rule would skip it
Nevermind in the confirm dialogs of Cooking and of a cartcloses the dialogit does not go to another page

When you design a new page

  1. Pick its level from the table above. Most new pages fit one of the six levels.
  2. Pick its fallback: where Back goes when the user opened the page from a link, with no way before it.
  3. Check the examples with the new page in them. Does Back land where a user expects?
  4. A new level, or a page that should break the rule, is a design decision. Bring it to the owner first.