Make sure the tag’s condition menu is within the limits of <body>
Otherwise, when the tag input is too close to the right side of the screen, it may be unreadable without scrolling.
This commit is contained in:
parent
149557e42e
commit
884c6dc2db
|
@ -428,6 +428,19 @@ class Tags extends HTMLDivElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conditions.remove();
|
conditions.remove();
|
||||||
|
|
||||||
|
details.addEventListener('toggle', function (e) {
|
||||||
|
const menu = e.target.querySelector('[role="menu"]');
|
||||||
|
if (e.target.open) {
|
||||||
|
const rect = menu.getBoundingClientRect();
|
||||||
|
if (rect.right > document.body.clientWidth) {
|
||||||
|
menu.style.left = Math.ceil(document.body.clientWidth - rect.right) + 'px';
|
||||||
|
}
|
||||||
|
console.log(rect, document.body.clientWidth);
|
||||||
|
} else {
|
||||||
|
menu.style.left = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue