fix(boss-dashboard): close sheet on backdrop click + tab switch
This commit is contained in:
parent
9101871fef
commit
ab0aa8ec8d
1 changed files with 10 additions and 0 deletions
|
|
@ -71,6 +71,7 @@ export default function BossDashboardView() {
|
|||
|
||||
useEffect(() => {
|
||||
void fetchData();
|
||||
closeSheet(); // also closes the sheet so we don't show stale window data
|
||||
}, [fetchData]);
|
||||
|
||||
// Realtime subscription (added in Task 14).
|
||||
|
|
@ -303,8 +304,17 @@ export default function BossDashboardView() {
|
|||
{/* Rep-activity bottom sheet */}
|
||||
<dialog
|
||||
ref={dialogRef}
|
||||
open={sheetRep !== null}
|
||||
className="fixed inset-x-0 bottom-0 w-full max-w-md mx-auto rounded-t-2xl bg-card border border-border/60 p-0 backdrop:bg-black/60"
|
||||
onClose={() => setSheetRep(null)}
|
||||
onClick={(e) => {
|
||||
// Close on backdrop click. Native <dialog> dispatches click events
|
||||
// on the dialog element itself when the user taps the backdrop;
|
||||
// clicks on the inner content have the inner <div> as their target.
|
||||
if (e.target === dialogRef.current) {
|
||||
closeSheet();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{sheetRep && (
|
||||
<div className="p-4 space-y-3">
|
||||
|
|
|
|||
Loading…
Reference in a new issue