mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
emoji_picker: Fix issue with emoji tab shifting.
In this commit we basically do these things: * Clear up section_head_offsets before pushing stuff in it so that its size doesn't keep on growing indefinitely with time and users opening emoji picker. * Make use of popover element to find the correct element in DOM to scan for section elements. This prevents us from filling stuff twice into section_head_offsets because of presence of two elements for '.emoji-popover-subheading' in DOM since popover destroy is an async call. * Using this popover element also helps in avoiding manuplation of the DOM elements of the popover that was destroyed (Because popover destroy is async it still maybe around). One instance of this is associating scroll event with the right instance of '.emoji-popover-emoji-map'.
This commit is contained in:
@@ -222,13 +222,16 @@ exports.toggle_emoji_popover = function (element, id) {
|
||||
};
|
||||
show_emoji_catalog();
|
||||
|
||||
$('.emoji-popover-subheading').each(function () {
|
||||
var popover = elt.data('popover').$tip;
|
||||
|
||||
section_head_offsets = [];
|
||||
popover.find('.emoji-popover-subheading').each(function () {
|
||||
section_head_offsets.push({
|
||||
section: $(this).attr('data-section'),
|
||||
position_y: $(this).position().top,
|
||||
});
|
||||
});
|
||||
var $emoji_map = $('.emoji-popover-emoji-map');
|
||||
var $emoji_map = popover.find('.emoji-popover-emoji-map');
|
||||
$emoji_map.on("scroll", function () {
|
||||
emoji_picker.emoji_select_tab($emoji_map);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user