element.classList.remove('active');
});
+ var scrollableContainer = elBySel('.reactionPopoverContent', this._getPopover());
if (reactionTypeID) {
var reactionTypeButton = elBySel('.reactionTypeButton[data-reaction-type-id="' + reactionTypeID + '"]', this._getPopover());
reactionTypeButton.classList.add('active');
elShow(reactionTypeButton);
}
- this._scrollReactionIntoView(reactionTypeButton);
+ this._scrollReactionIntoView(scrollableContainer, reactionTypeButton);
+ }
+ else {
+ // The "first" reaction is positioned as close as possible to the toggle button,
+ // which means that we need to scroll the list to the bottom if the popover is
+ // displayed above the toggle button.
+ if (UiScreen.is('screen-xs') && !this._getPopover().classList.contains('inverseOrder')) {
+ scrollableContainer.scrollTop = scrollableContainer.scrollHeight - scrollableContainer.clientHeight;
+ }
}
},
- _scrollReactionIntoView: function (reactionTypeButton) {
- var scrollableContainer = elBySel('.reactionPopoverContent', this._getPopover());
-
+ _scrollReactionIntoView: function (scrollableContainer, reactionTypeButton) {
// Do not scroll if the button is located in the upper 75%.
if (reactionTypeButton.offsetTop < scrollableContainer.clientHeight * 0.75) {
scrollableContainer.scrollTop = 0;
this._markReactionAsActive();
+ this._rebuildOverflowIndicator();
+
popover.classList.remove('forceHide');
popover.classList.add('active');
},
document.body.appendChild(this._popover);
- this._rebuildOverflowIndicator();
DomChangeListener.trigger();
}
@include screen-xs {
&.inverseOrder .reactionTypeButtonList {
- flex-direction: column-reverse;
+ flex-direction: column;
}
}
}
@include screen-xs {
.reactionTypeButtonList {
display: flex;
- flex-direction: column;
+ flex-direction: column-reverse;
}
}