fix(ui): close pending/hidden devices modal via the X on Firefox
The close X used a raw <button onClick={onClose}>, bypassing Base UI's
dismissal. Outside-click worked (it goes through onOpenChange) but the
synthetic click on the X was dropped on Firefox/Windows. Route the X
through Base UI's DialogClose, the same path as outside-click and the
library's default close button. Add a regression test.
ha-relevant: maybe
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
Globe, Router, Server, Layers, Box, Container, HardDrive, Cpu, Wifi, Circle, Network,
|
||||
Search, RefreshCw, X, CheckCircle2, EyeOff, Trash2, Loader2,
|
||||
} from 'lucide-react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import { Dialog, DialogClose, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import { scanApi } from '@/api/client'
|
||||
import { useCanvasStore } from '@/stores/canvasStore'
|
||||
import { toast } from 'sonner'
|
||||
@@ -408,9 +408,20 @@ export function PendingDevicesModal({ open, onClose, highlightId, initialStatus
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
)}
|
||||
<button onClick={onClose} className="text-muted-foreground hover:text-foreground p-1.5 rounded transition-colors" title="Close">
|
||||
{/* Route the close X through Base UI's DialogClose (same path as
|
||||
outside-click) instead of a raw onClick — the latter's synthetic
|
||||
click was being dropped on Firefox/Windows. */}
|
||||
<DialogClose
|
||||
render={
|
||||
<button
|
||||
className="text-muted-foreground hover:text-foreground p-1.5 rounded transition-colors"
|
||||
title="Close"
|
||||
aria-label="Close"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</DialogClose>
|
||||
</div>
|
||||
</div>
|
||||
</DialogHeader>
|
||||
|
||||
Reference in New Issue
Block a user