mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 07:11:18 +02:00
fix: clamp student popover position to stay within viewport vertically
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# TODO
|
||||
|
||||
- [x] Fix relinked file not appearing in FilePond UI: switch to ID-based input lookup
|
||||
- [x] Fix student name popover overflowing below viewport: clamp position so popover stays within screen bounds
|
||||
|
||||
@@ -15,6 +15,16 @@
|
||||
if (left + 300 > window.innerWidth + window.scrollX) {
|
||||
left = r.left + window.scrollX - 312;
|
||||
}
|
||||
// Keep popover within viewport vertically
|
||||
var popHeight = popover.offsetHeight || 300;
|
||||
var viewBottom = window.innerHeight + window.scrollY;
|
||||
if (top + popHeight > viewBottom) {
|
||||
top = viewBottom - popHeight - 8;
|
||||
// Don't shift above the viewport top
|
||||
if (top < window.scrollY) {
|
||||
top = window.scrollY + 8;
|
||||
}
|
||||
}
|
||||
popover.style.left = `${left}px`;
|
||||
popover.style.top = `${top}px`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user