FIX: do not restore scroll on successive click on the same first emoji
This commit is contained in:
parent
2f8f2aa1dd
commit
bb35d9fc07
|
@ -90,6 +90,7 @@ export default Ember.Component.extend({
|
||||||
const $recentSection = $list.find(".section[data-section='recent']");
|
const $recentSection = $list.find(".section[data-section='recent']");
|
||||||
const $recentSectionGroup = $recentSection.find(".section-group");
|
const $recentSectionGroup = $recentSection.find(".section-group");
|
||||||
const $recentCategory = $picker.find(".category-icon button[data-section='recent']").parent();
|
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
|
// we set height to 0 to avoid it being taken into account for scroll position
|
||||||
if(_.isEmpty(this.get("recentEmojis"))) {
|
if(_.isEmpty(this.get("recentEmojis"))) {
|
||||||
|
@ -105,11 +106,12 @@ export default Ember.Component.extend({
|
||||||
});
|
});
|
||||||
const template = findRawTemplate("emoji-picker-recent")({recentEmojis});
|
const template = findRawTemplate("emoji-picker-recent")({recentEmojis});
|
||||||
$recentSectionGroup.html(template);
|
$recentSectionGroup.html(template);
|
||||||
this._bindHover($recentSectionGroup);
|
|
||||||
|
|
||||||
if(this.get("recentEmojis").length === 1) {
|
if(persistScrollPosition) {
|
||||||
$list.scrollTop(previousScrollTop + $recentSection.outerHeight());
|
$list.scrollTop(previousScrollTop + $recentSection.outerHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._bindHover($recentSectionGroup);
|
||||||
},
|
},
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
|
Loading…
Reference in New Issue