FIX: do not restore scroll on successive click on the same first emoji

This commit is contained in:
Joffrey JAFFEUX 2017-07-21 21:42:19 +02:00
parent 2f8f2aa1dd
commit bb35d9fc07
1 changed files with 4 additions and 2 deletions

View File

@ -90,6 +90,7 @@ export default Ember.Component.extend({
const $recentSection = $list.find(".section[data-section='recent']");
const $recentSectionGroup = $recentSection.find(".section-group");
const $recentCategory = $picker.find(".category-icon button[data-section='recent']").parent();
let persistScrollPosition = !$recentCategory.is(':visible') ? true : false;
// we set height to 0 to avoid it being taken into account for scroll position
if(_.isEmpty(this.get("recentEmojis"))) {
@ -105,11 +106,12 @@ export default Ember.Component.extend({
});
const template = findRawTemplate("emoji-picker-recent")({recentEmojis});
$recentSectionGroup.html(template);
this._bindHover($recentSectionGroup);
if(this.get("recentEmojis").length === 1) {
if(persistScrollPosition) {
$list.scrollTop(previousScrollTop + $recentSection.outerHeight());
}
this._bindHover($recentSectionGroup);
},
close() {