mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 16:05:23 +02:00
fix: portal all filter popovers to prevent occlusion by sticky columns
This commit is contained in:
@@ -32,7 +32,8 @@ export function ColumnFilterPopover({
|
||||
onClose,
|
||||
title,
|
||||
className,
|
||||
zIndex = 50
|
||||
zIndex = 50,
|
||||
triggerId
|
||||
}: ColumnFilterPopoverProps) {
|
||||
const [search, setSearch] = useState('');
|
||||
const [activeTab, setActiveTab] = useState<'values' | 'condition'>('values');
|
||||
@@ -52,15 +53,16 @@ export function ColumnFilterPopover({
|
||||
document.body.appendChild(container);
|
||||
setPortalContainer(container);
|
||||
|
||||
const btns = document.querySelectorAll('.filter-trigger-btn');
|
||||
btns.forEach(btn => {
|
||||
if (btn instanceof HTMLElement) {
|
||||
const rect = btn.getBoundingClientRect();
|
||||
const currentLeft = rect.left;
|
||||
const currentTop = rect.bottom + 4;
|
||||
setPosition({ top: currentTop, left: currentLeft });
|
||||
if (triggerId) {
|
||||
const trigger = document.getElementById(triggerId);
|
||||
if (trigger) {
|
||||
const rect = trigger.getBoundingClientRect();
|
||||
setPosition({
|
||||
top: rect.bottom + window.scrollY + 4,
|
||||
left: Math.min(rect.left + window.scrollX, window.innerWidth - 300)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (document.body.contains(container)) {
|
||||
@@ -195,7 +197,11 @@ export function ColumnFilterPopover({
|
||||
"absolute w-72 bg-slate-800 border border-slate-700 rounded-lg shadow-2xl p-3 flex flex-col gap-3 animate-in fade-in zoom-in-95 duration-100 pointer-events-auto",
|
||||
className
|
||||
)}
|
||||
style={{ zIndex: 9999 }}
|
||||
style={{
|
||||
zIndex: 9999,
|
||||
top: position.top - window.scrollY,
|
||||
left: position.left - window.scrollX
|
||||
}}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user