# Returning to a search via back

**URL:** <https://meta.discourse.org/t/returning-to-a-search-via-back/61503>\
**Category:** Bug\
**Created:** [24 באפריל,‏ 2017,‏ 4:08pm UTC](https://meta.discourse.org/t/returning-to-a-search-via-back/61503 "2017-04-24T16:08:10Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [11 באוגוסט,‏ 2017,‏ 8:24am UTC](https://meta.discourse.org/t/returning-to-a-search-via-back/61503/6 "2017-08-11T08:24:49Z")

</div>

Hi Bianca,

I would implement it this way:

```plaintext
import Scrolling from "discourse/mixins/scrolling";

export default Ember.Component.extend(Scrolling, {
  didInsertElement() {
    this._super();

    this.bindScrolling({ name: this.get("name") });
  },

  didRender() {
    this._super();

    const scrollToY = this.session.get(this.get("trackerName"));
    if (scrollToY && scrollToY >= 0) {
      Ember.run.next(() => $(window).scrollTop(scrollToY + 1));
    }
  },

  didReceiveAttrs() {
    this._super();

    this.set("trackerName", `scroll-tracker-${this.get("name")}`);
  },

  willDestroyElement() {
    this._super();

    this.unbindScrolling(this.get("name"));
  },

  scrolled() {
    this._super();

    this.session.set(this.get("trackerName"), $(window).scrollTop());
  },
});

```

It should work, feel free to modify the coding style. Thanks for your contribution.

---

_[View the full topic](https://meta.discourse.org/t/returning-to-a-search-via-back/61503)._
