Commit e87db91e authored by JC Brand's avatar JC Brand

dom-navigator: properly call static method.

emoji-views: Add scroll offset
parent b339f99c
......@@ -410,7 +410,8 @@ converse.plugins.add('converse-emoji-views', {
const el = this.el.querySelector('.emoji-picker__lists');
const heading = this.el.querySelector(`#emoji-picker-${category}`);
if (heading) {
el.scrollTop = heading.offsetTop - heading.offsetHeight*3;
// +4 due to 2px padding on list elements
el.scrollTop = heading.offsetTop - heading.offsetHeight*3 + 4;
}
},
......
......@@ -223,13 +223,13 @@ class DOMNavigator {
const top = this.selected.offsetTop + this.selected.offsetHeight;
const els = this.elementsAfter(0, top);
const getDistance = el => Math.abs(el.offsetLeft - left) + Math.abs(el.offsetTop - top);
el = this.getClosestElement(els, getDistance);
el = DOMNavigator.getClosestElement(els, getDistance);
} else if (direction == DOMNavigator.DIRECTION.up) {
const left = this.selected.offsetLeft;
const top = this.selected.offsetTop - 1;
const els = this.elementsBefore(Infinity, top);
const getDistance = el => Math.abs(left - el.offsetLeft) + Math.abs(top - el.offsetTop);
el = this.getClosestElement(els, getDistance);
el = DOMNavigator.getClosestElement(els, getDistance);
} else {
throw new Error("getNextElement: invalid direction value");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment