1

In my project, I have a contact table and when we want, we can delete input values. If click the deleted values, the table opens a modal. If I have 6 contacts' information, the modals background is dark. But if I have just 2 contacts' info in my table, the modals background is little bit dark. How can I solve this problem?

This is my modal component page;

    return (
    <>
      <Modal
        show={show}
        onHide={handleClose}
        backdrop="static"
        keyboard={false}
      >
        
{children}
       
        
      </Modal>
    </>
  );

This is my table page;

return (

    <>
    <tr>
        <td>{addForm.fullName}</td>
        <td>   {addForm.email}</td>
        <td>{addForm.phoneNumber}</td>
        <td>{addForm.country}</td>
        <td>
            <div className="icon-delete" onClick={() => setShowModal(true)}> </div>
        </td>
    </tr>
   <ModalComponent
    show={showModal}
    handleClose={handleClose}>
    <Modal.Header closeButton>
    
            </Modal.Header>
    <Modal.Body>
     <p> <b> Are you sure you want to delete? </b> </p>
    </Modal.Body>
  <Modal.Footer>
    <Button variant="primary" onClick={()=> handleClose(addForm.id)}>
      Yes
    </Button>
    <Button variant="secondary" onClick={()=>setShowModal(false)}> No </Button>
  </Modal.Footer>
  </ModalComponent>
        </>

);

Screen shot of a darker background with many modals

Screen shot of a lighter background with fewer modals

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
  • 1
    it the issue of multiple overlays – uditkumar01 Aug 24 '22 at 13:37
  • You may want to consider showing only one modal at a time. Currently all 6 are showing, each with a partially transparent background. That "partial" transparency builds up. Also, I would think the user would be confused by having 6 "Are you sure you want to delete?" modals appearing, with no way of knowing which item they are confirming is getting deleted. Maybe it would be better to have one modal asking "Are you sure you want to delete the 6 selected items?" instead. – Heretic Monkey Aug 24 '22 at 13:41

0 Answers0