From 7f89f8aa3f247f2617064623dfe26129d8718e74 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Sat, 16 Dec 2017 20:46:22 +0100 Subject: [PATCH] FIX: reset scroll position when switching tab in edit category modal --- .../discourse/components/edit-category-tab.js.es6 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 b/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 index 556e072ea15..220da95a4ac 100644 --- a/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 +++ b/app/assets/javascripts/discourse/components/edit-category-tab.js.es6 @@ -23,9 +23,17 @@ export default Em.Component.extend({ this.get('panels').addObject(this.get('tabClassName')); }, + _resetModalScrollState() { + const $modalBody = this.$().parents("#discourse-modal").find(".modal-body"); + if ($modalBody.length === 1) { + $modalBody.scrollTop(0); + } + }, + actions: { select: function() { this.set('selectedTab', this.get('tab')); + this._resetModalScrollState(); } } });