You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the popover component doesn't offer any way to control it's visibility. This leads to some bugs that are not desirable.
🧐 To Reproduce
Steps to reproduce the behavior:
Open a Popover that opens a modal (for example, a Menu popover on a Table Row with actions).
Both the modal and the popover will be shown on screen, and the only way to disable this is targeting ALL the popovers via CSS (as suggested by Tiendanube's support team).
This leads to another bug: I can't use any Popover inside the modal (like the Calendar for Date Picking).
✅ Expected behavior
The popover should expose a variable for controlling it's visibility. Because Popovers are rendered at the document.body level via React Portal, targeting the visibility of any parent element is not enough.
📷 Screenshots
🖥 Desktop (please complete the following information):
OS: Windows 10
Browser: Chrome
Version: 128.0.6613.138
❗️ Additional context
Here's a code snippet for testing purposes:
importReactfrom"react";import{Box,Button,Icon,Input,Modal,Popover,Text,Title,}from"@nimbus-ds/components";import{DownloadIcon,FileAltIcon,EllipsisIcon,CalendarIcon,}from"@nimbus-ds/icons";import{Calendar}from"@nimbus-ds/patterns";import{format}from"date-fns";import{es}from"date-fns/locale";constExample=()=>{const[modalProps,setModalProps]=React.useState({isOpen: false,invoiceId: "",amount: "",});// Tiendanube's official fix: This prevents the Date Picker modal from showing./* React.useEffect(() => { if (modalProps.isOpen) { document.body.classList.add("[&>#nimbus-popover-floating]:hidden"); } else { document.body.classList.remove("[&>#nimbus-popover-floating]:hidden"); } }, [modalProps]); */constInvoiceModal=()=>{const[selectedDate,setSelectedDate]=React.useState<Date|undefined>();return(<Modalopen={modalProps.isOpen}onDismiss={()=>setModalProps((prev)=>({
...prev,isOpen: false,}))}><Modal.Header><BoxalignItems="center"display="flex"gap="4"justifyContent="space-between"><Titleas="h3">Custom action</Title></Box></Modal.Header><Modal.Body><Boxdisplay="flex"flexDirection="column"gap="2"><TextfontSize="base"lineHeight="base"textAlign="left">
Invoice id:
<spanclassName="font-bold">{modalProps.invoiceId}</span></Text><TextfontSize="base"lineHeight="base"textAlign="left">
Amount: <spanclassName="font-bold">{modalProps.amount}</span></Text></Box><Boxwidth="full"display="flex"flexDirection="column"gap="1"><Text>Date field</Text><Popovercontent={<Calendarmode="single"showOutsideDaysselected={selectedDate}onSelect={setSelectedDate}hideBorderlocale={es}fullWidthDayscontainerProps={{width: "100%",height: "100%",overflowY: "auto",maxHeight: "400px",}}required/>}padding="none"arrow={true}><Inputid="customDate"name="customDate"readOnlyvalue={selectedDate&&format(selectedDate,"dd-MM-yyyy")}placeholder="03/04/2024"append={<Iconcolor="neutral-textLow"source={<CalendarIcon/>}/>}appendPosition="end"/></Popover></Box></Modal.Body><Modal.Footer><Buttonappearance="neutral"onClick={()=>{setModalProps((prev)=>({
...prev,isOpen: false,}));}}>
Close
</Button><Buttonappearance="primary"onClick={()=>{setModalProps((prev)=>({
...prev,isOpen: false,}));}}>
Submit
</Button></Modal.Footer></Modal>);};return(<><InvoiceModal/><Boxdisplay="flex"justifyContent="center"><Popoverposition="left"content={<Boxdisplay="flex"flexDirection="column"gap="2"><Buttonappearance="transparent"as="a"href="/"><Iconsource={<DownloadIcon/>}/>
Option 1
</Button><Buttonappearance="transparent"onClick={()=>{setModalProps({isOpen: true,invoiceId: "123456",amount: "1000",});}}><Iconsource={<FileAltIcon/>}/>
Open Action Modal (with props)
</Button></Box>}><Buttonappearance="transparent"><Iconcolor="neutral-textHigh"source={<EllipsisIcon/>}/></Button></Popover></Box></>);};exportdefaultExample;
The text was updated successfully, but these errors were encountered:
🐛 Describe the bug
Currently, the popover component doesn't offer any way to control it's visibility. This leads to some bugs that are not desirable.
🧐 To Reproduce
Steps to reproduce the behavior:
✅ Expected behavior
The popover should expose a variable for controlling it's visibility. Because Popovers are rendered at the document.body level via React Portal, targeting the visibility of any parent element is not enough.
📷 Screenshots
🖥 Desktop (please complete the following information):
❗️ Additional context
Here's a code snippet for testing purposes:
The text was updated successfully, but these errors were encountered: