fix: replace Portal with inline block to avoid Radix pointer-event capture

This commit is contained in:
null 2026-06-04 01:50:40 -05:00
parent 68667fea59
commit d04f03b6b1
1 changed files with 26 additions and 38 deletions

View File

@ -8,7 +8,6 @@ import {
import { api } from '@/api'; import { api } from '@/api';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import * as Portal from '@radix-ui/react-portal';
import { Input } from '@/components/ui/input'; import { Input } from '@/components/ui/input';
// Debounce helper // Debounce helper
@ -256,24 +255,14 @@ export default function BillMerchantRules({ billId, onRulesChanged }) {
</Button> </Button>
</div> </div>
{/* Suggestions rendered in a Portal so the list escapes the BillModal's {/* Suggestions inline block, no absolute positioning.
overflow-y-auto container and is fully clickable regardless of scroll */} Avoids overflow-y-auto clipping AND Radix Dialog pointer-event capture. */}
{showSuggestions && filteredSuggestions.length > 0 && inputRef.current && ( {showSuggestions && filteredSuggestions.length > 0 && (
<Portal.Root> <div className="overflow-hidden rounded-lg border border-border/80 bg-card shadow-sm">
<div
style={{
position: 'fixed',
top: inputRef.current.getBoundingClientRect().bottom + 4,
left: inputRef.current.getBoundingClientRect().left,
width: inputRef.current.getBoundingClientRect().width,
zIndex: 9999,
}}
className="overflow-hidden rounded-lg border border-border/80 bg-card shadow-md"
>
<p className="border-b border-border/50 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground"> <p className="border-b border-border/50 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground">
Recent unmatched transactions Recent unmatched transactions
</p> </p>
<div className="max-h-48 overflow-y-auto"> <div className="max-h-40 overflow-y-auto">
{filteredSuggestions.map(s => { {filteredSuggestions.map(s => {
const amountVal = Math.abs(Number(s.amount || 0)) / 100; const amountVal = Math.abs(Number(s.amount || 0)) / 100;
return ( return (
@ -293,7 +282,6 @@ export default function BillMerchantRules({ billId, onRulesChanged }) {
})} })}
</div> </div>
</div> </div>
</Portal.Root>
)} )}
{/* Conflict warning */} {/* Conflict warning */}