From c118153f2f48a271cb8d4859e5c65e22cd59ee5f Mon Sep 17 00:00:00 2001 From: Curtis Ekstrom Date: Mon, 15 Feb 2016 23:40:08 +0100 Subject: [PATCH 1/2] Remove click handler overriding default link behavior An [issue](https://github.com/travis-ci/travis-ci/issues/5181) was reported in which the repository sidebar links were not functioning properly. I've tracked it down to the fact that a click handler was registered and automatically performing a redirect to the repo route. This breaks CMD+Click behavior (as the click handler was still called and navigating when the user did not expect it, as well as navigated to a link that the user did not intend to visit. This commit simply removes that click handler. I checked the previous coffee version of the file to gain more context on why it was initially added, but unfortunately, it was simply added when the original component was created, so I'm not sure what its use was. --- app/components/repos-list-item.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/components/repos-list-item.js b/app/components/repos-list-item.js index 89b777d2..68b7d427 100644 --- a/app/components/repos-list-item.js +++ b/app/components/repos-list-item.js @@ -23,10 +23,5 @@ export default Ember.Component.extend(Polling, { scrollTop: 0 }, 200); } - }, - - click() { - this.scrollTop(); - return this.get('routing').transitionTo('repo', this.get('repo.slug').split('/')); } }); From 2ae61562ead752d7ed29d61a6b2a380d36be4c99 Mon Sep 17 00:00:00 2001 From: Curtis Ekstrom Date: Tue, 16 Feb 2016 14:10:12 +0100 Subject: [PATCH 2/2] Ensure scroll position reset This adds a new mixin that allows us to opt in to scroll reset behavior. --- app/mixins/scroll-reset.js | 8 ++++++++ app/routes/repo.js | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 app/mixins/scroll-reset.js diff --git a/app/mixins/scroll-reset.js b/app/mixins/scroll-reset.js new file mode 100644 index 00000000..0909e82a --- /dev/null +++ b/app/mixins/scroll-reset.js @@ -0,0 +1,8 @@ +import Ember from 'ember'; + +export default Ember.Mixin.create({ + activate: function() { + this._super(...arguments); + window.scrollTo(0,0); + } +}); diff --git a/app/routes/repo.js b/app/routes/repo.js index eb638147..346e1e59 100644 --- a/app/routes/repo.js +++ b/app/routes/repo.js @@ -1,8 +1,9 @@ import TravisRoute from 'travis/routes/basic'; import Repo from 'travis/models/repo'; +import ScrollResetMixin from 'travis/mixins/scroll-reset'; import Ember from 'ember'; -export default TravisRoute.extend({ +export default TravisRoute.extend(ScrollResetMixin, { store: Ember.inject.service(), titleToken(model) {