Autocomplete helper: fix scrolling to start
This commit is contained in:
parent
4908fff723
commit
ce033077f7
@ -21,10 +21,20 @@ export default class EmojiHelper extends AutocompleteHelper {
|
|||||||
this.container.append(this.list);
|
this.container.append(this.list);
|
||||||
|
|
||||||
this.scrollable = new ScrollableX(this.container);
|
this.scrollable = new ScrollableX(this.container);
|
||||||
|
|
||||||
|
this.addEventListener('visible', () => {
|
||||||
|
setTimeout(() => { // it is not rendered yet
|
||||||
|
this.scrollable.container.scrollLeft = 0;
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderEmojis(emojis: string[]) {
|
public renderEmojis(emojis: string[]) {
|
||||||
if(this.init) {
|
if(this.init) {
|
||||||
|
if(!emojis.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
this.init = null;
|
this.init = null;
|
||||||
}
|
}
|
||||||
@ -36,10 +46,6 @@ export default class EmojiHelper extends AutocompleteHelper {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.hidden) {
|
|
||||||
this.scrollable.container.scrollLeft = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.toggle(!emojis.length);
|
this.toggle(!emojis.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,12 @@ export default class StickersHelper extends AutocompleteHelper {
|
|||||||
}, 'ArrowUp');
|
}, 'ArrowUp');
|
||||||
|
|
||||||
this.container.classList.add('stickers-helper');
|
this.container.classList.add('stickers-helper');
|
||||||
|
|
||||||
|
this.addEventListener('visible', () => {
|
||||||
|
setTimeout(() => { // it is not rendered yet
|
||||||
|
this.scrollable.container.scrollTop = 0;
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkEmoticon(emoticon: string) {
|
public checkEmoticon(emoticon: string) {
|
||||||
@ -75,10 +81,6 @@ export default class StickersHelper extends AutocompleteHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ready.then(() => {
|
ready.then(() => {
|
||||||
if(!this.hidden) {
|
|
||||||
this.scrollable.container.scrollTop = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.list.replaceWith(container);
|
this.list.replaceWith(container);
|
||||||
this.list = container;
|
this.list = container;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user