Fix following by bubble beside button on mobiles

This commit is contained in:
Eduard Kuzmenko 2020-11-12 01:20:32 +02:00
parent 12f7baa13a
commit 6e59816eec
2 changed files with 3 additions and 2 deletions

View File

@ -80,7 +80,7 @@ export default class ChatContextMenu {
const className = (e.target as HTMLElement).className;
if(!className || !className.includes) return;
const good = ['bubble', 'bubble__container', 'message', 'time', 'inner'].find(c => className.includes(c));
const good = ['bubble', 'bubble__container', 'message', 'time', 'inner'].find(c => className.match(new RegExp(c + '($|\\s)')));
if(good) {
onContextMenu(e);
}

View File

@ -228,6 +228,7 @@ export function positionMenu({clientX, clientY}: {clientX: number, clientY: numb
}
// ! don't need reverse for this, this will be the side WHERE ANIMATION WILL END !
// ! NO LOGIC HERE !
let verticalSide: 'top' | 'bottom';
if(side !== undefined) {
@ -251,7 +252,7 @@ export function positionMenu({clientX, clientY}: {clientX: number, clientY: numb
}
if((clientY + scrollHeight + PADDING_TOP) > innerHeight) {
elem.style.top = Math.max(PADDING_TOP, clientY - scrollHeight) + 'px';
elem.style.top = clamp(clientY - scrollHeight, PADDING_TOP, innerHeight - scrollHeight - PADDING_TOP) + 'px';
// elem.style.top = (innerHeight - scrollHeight - PADDING_TOP) + 'px';
verticalSide = 'top';
} else {