mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-19 15:47:04 +02:00
Fix filament hover card overlapping navigation bar (#259)
The FilamentHoverCard positioning logic now accounts for the fixed 56px header when calculating available space above the trigger element. Previously, when hovering over AMS slots near the top of the page, the hover card would appear above the slot but go behind the navigation bar. Now it correctly detects there isn't enough usable space and flips to show below the slot instead. Closes #259
This commit is contained in:
@@ -87,10 +87,12 @@ export function FilamentHoverCard({ data, children, disabled, className = '', sp
|
||||
if (isVisible && triggerRef.current && cardRef.current) {
|
||||
const triggerRect = triggerRef.current.getBoundingClientRect();
|
||||
const cardHeight = cardRef.current.offsetHeight;
|
||||
const spaceAbove = triggerRect.top;
|
||||
// Account for fixed header (56px) - space above should exclude header area
|
||||
const headerHeight = 56;
|
||||
const spaceAbove = triggerRect.top - headerHeight;
|
||||
const spaceBelow = window.innerHeight - triggerRect.bottom;
|
||||
|
||||
// Prefer top, but flip to bottom if not enough space
|
||||
// Prefer top, but flip to bottom if not enough space (accounting for header)
|
||||
if (spaceAbove < cardHeight + 12 && spaceBelow > spaceAbove) {
|
||||
setPosition('bottom');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user