fix: Dashboard Card-Dropdown nicht mehr abgeschnitten
- CSS: position: fixed statt absolute, z-index: 1000, box-shadow - JS: Position dynamisch berechnet (getBoundingClientRect) beim Öffnen - Viewport-Overflow-Korrektur falls Dropdown zu weit rechts/links
This commit is contained in:
1 parent
4fa0111c33
commit
90afd79e76
3 files changed
+33
-5
No files matched your search
@@ -78,7 +78,21 @@ registerPage('dashboard', {
|
||||
menuTrigger.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
closeAllCardMenus();
|
||||
// Position fixed dropdown relative to trigger
|
||||
const rect = menuTrigger.getBoundingClientRect();
|
||||
menuDropdown.style.top = `${rect.bottom + 4}px`;
|
||||
menuDropdown.style.left = `${rect.right - menuDropdown.offsetWidth}px`;
|
||||
menuDropdown.hidden = !menuDropdown.hidden;
|
||||
// Adjust if off-screen right
|
||||
if (!menuDropdown.hidden) {
|
||||
const dropRect = menuDropdown.getBoundingClientRect();
|
||||
if (dropRect.right > window.innerWidth) {
|
||||
menuDropdown.style.left = `${window.innerWidth - dropRect.width - 8}px`;
|
||||
}
|
||||
if (dropRect.left < 0) {
|
||||
menuDropdown.style.left = '8px';
|
||||
}
|
||||
}
|
||||
});
|
||||
chatBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
@@ -209,7 +223,21 @@ registerPage('dashboard', {
|
||||
menuTrigger.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
closeAllCardMenus();
|
||||
// Position fixed dropdown relative to trigger
|
||||
const rect = menuTrigger.getBoundingClientRect();
|
||||
menuDropdown.style.top = `${rect.bottom + 4}px`;
|
||||
menuDropdown.style.left = `${rect.right - menuDropdown.offsetWidth}px`;
|
||||
menuDropdown.hidden = !menuDropdown.hidden;
|
||||
// Adjust if off-screen right
|
||||
if (!menuDropdown.hidden) {
|
||||
const dropRect = menuDropdown.getBoundingClientRect();
|
||||
if (dropRect.right > window.innerWidth) {
|
||||
menuDropdown.style.left = `${window.innerWidth - dropRect.width - 8}px`;
|
||||
}
|
||||
if (dropRect.left < 0) {
|
||||
menuDropdown.style.left = '8px';
|
||||
}
|
||||
}
|
||||
});
|
||||
menuDropdown.querySelector('[data-action="files"]').addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
Reference in new issue
Block a user