# Adding a Back Button to Return to Scrolled Position

**URL:** https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694
**Category:** Development
**Tags:** ux
**Created:** [September 9, 2024, 6:24pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694 "2024-09-09T18:24:06Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![cristo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cristo/32/434899_2.png) [@cristo](https://meta.discourse.org/u/cristo)
#### Post date: [September 9, 2024, 6:24pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/1 "2024-09-09T18:24:06Z")

</div>

Hi everyone,

I need help with navigation on my app. Here’s the flow I’m working on:

1. The user scrolls down the home screen (image attached: “home”), reading the titles of the latest topics.
2. When they click on a specific topic (image attached: “Bear hugs gone too far”), they are taken to the topic details screen (image attached: “topic screen”), where they can read the full text and replies.
3. **The issue** : there’s no “back” button that allows the user to return to the same point in the scroll on the home screen to continue browsing topics.

How can I add a button to return the user to the exact scroll position they were in on the home screen?

Thanks in advance for any suggestions!

 ![Home](https://global.discourse-cdn.com/meta/original/4X/d/3/5/d35be90cbd5deef34656b842b74e0fc50b3ac465.jpeg)  
 ![Bear hugs gone too far](https://global.discourse-cdn.com/meta/original/4X/2/2/9/22908a1e39f8e18b417ee949de3fc6f98e8d2173.jpeg)  
 ![Topic screen](https://global.discourse-cdn.com/meta/original/4X/e/2/e/e2e5b73f203d2cfecd3cf09d9c97d1b2654fddc9.jpeg)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [September 9, 2024, 6:28pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/2 "2024-09-09T18:28:47Z")

</div>

Swipe right from left side.

---

<div class="post-metadata">

### Author: ![cristo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cristo/32/434899_2.png) [@cristo](https://meta.discourse.org/u/cristo)
#### Post date: [September 9, 2024, 6:56pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/3 "2024-09-09T18:56:39Z")

</div>

Tried that but it doesn’t work. Thanks anyway, @merefield !

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [September 9, 2024, 7:25pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/4 "2024-09-09T19:25:34Z")

</div>

Works here on Meta too

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 9, 2024, 7:44pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/5 "2024-09-09T19:44:54Z")

</div>

Call me confused but doesn’t your browser have a back button? I just tested on my iPhone in Safari and Chrome and the back buttons take me right back to where I was in the topic list page. The swiping left and right to go back and forward respectively (like what Robert mentioned above) also works. 🤔 hub app also has back and forward buttons and swiping.

---

<div class="post-metadata">

### Author: ![cristo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cristo/32/434899_2.png) [@cristo](https://meta.discourse.org/u/cristo)
#### Post date: [September 9, 2024, 10:04pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/6 "2024-09-09T22:04:13Z")

</div>

sorry for not giving the full context: my discourse community is embedded in our mobile app…maybe that’s why there’s no back button and the swiping doesn’t work?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [September 9, 2024, 10:11pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/7 "2024-09-09T22:11:03Z")

</div>

So that’s your problem 🙂

Rather unnecessary too (at least on Android) as it has excellent support for PWAs natively (one of the reasons I switched from Apple and their dragging feet)

Discourse is a PWA out of the box 🚀

Just install the website.

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [September 9, 2024, 11:03pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/8 "2024-09-09T23:03:13Z")

</div>

Hi @cristo !  
If you really want to have it embedded, maybe this component will help?

> [@Breadcrumb Links](https://meta.discourse.org/t/breadcrumb-links/325372):
>
> information_sourceSummary Breadcrumb LinkseyeglassesPreview [README](https://github.com/denvergeeks/discourse-breadcrumb-links/blob/main/README.md)hammer_and_wrenchRepository [GitHub - denvergeeks/discourse-breadcrumb-links: Breadcrumb Navigation for Discourse · GitHub](https://github.com/denvergeeks/discourse-breadcrumb-links)questionInstall Guide [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Basic Breadcrumb Links On all Topic pages: displays links back to the Subcategory (if any) and …

Though I’m not sure if it goes back to the scrolled position.

---

<div class="post-metadata">

### Author: ![cristo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cristo/32/434899_2.png) [@cristo](https://meta.discourse.org/u/cristo)
#### Post date: [September 24, 2024, 1:17pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/9 "2024-09-24T13:17:39Z")

</div>

@NateDhaliwal many thanks!!

It helped yes! There’s just one detail that maybe you know how to fix.

The back button disappears when you scroll down (please see attached video)…is it possible to have the back button fixed/floating at the top of the screen so that it remains visible even when scrolling?

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [September 25, 2024, 12:08am UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/10 "2024-09-25T00:08:01Z")

</div>

Hi there. As I don’t control this component, you will have to make this request in the component’s topic itself. Thanks!

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 25, 2024, 12:32am UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/11 "2024-09-25T00:32:47Z")

</div>

Sorry I don’t know android apps well, but is this not a back button?

 ![A smartphone screen displays a conversation with a chatbot, emphasizing the "Bookmark" feature. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/3/7/6/3762f962a078db4b968849f8339ca0b84e171066.jpeg)

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [September 25, 2024, 12:44am UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/12 "2024-09-25T00:44:54Z")

</div>

I think they were referring to the component’s back button.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [September 25, 2024, 6:02am UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/13 "2024-09-25T06:02:07Z")

</div>

This button is going to be clunky and unnecessary.

Ultimately there is something wrong with the app that’s preventing swipe back which is native to Discourse and should be supported by the app.

I have deployed several apps to the app store and play store (none of which had this issue)

If you have budget I can take a look at the root cause for you.

---

<div class="post-metadata">

### Author: ![cristo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cristo/32/434899_2.png) [@cristo](https://meta.discourse.org/u/cristo)
#### Post date: [October 8, 2024, 11:17pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/14 "2024-10-08T23:17:10Z")

</div>

Yes, it is. But when users click on that button the app closes (goes to background) instead of navigating back.

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [October 8, 2024, 11:40pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/15 "2024-10-08T23:40:58Z")

</div>

@cristo could you please give this existing TC a try and let me know your thoughts…

[https://github.com/davidkingham/mobile-navigation/](https://github.com/davidkingham/mobile-navigation/)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [October 9, 2024, 12:41am UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/16 "2024-10-09T00:41:26Z")

</div>

I just tried on iphone 15 pro max - the `back` and `forward` buttons don’t show up in safari, and they show up in chrome but don’t work 😢

---

<div class="post-metadata">

### Author: ![cristo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cristo/32/434899_2.png) [@cristo](https://meta.discourse.org/u/cristo)
#### Post date: [October 10, 2024, 4:48pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/17 "2024-10-10T16:48:53Z")

</div>

I tried it on our mobile app (embedded webview) and it didn’t work.

The back and forward buttons do appear but nothing happens when I click on them.

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [October 10, 2024, 6:35pm UTC](https://meta.discourse.org/t/adding-a-back-button-to-return-to-scrolled-position/325694/18 "2024-10-10T18:35:34Z")

</div>

Thanks for checking that and please do post any additional design ideas or examples you find.
