1

I am facing an issue passing in the proper node element to the getContainer property. I'd like to display a Modal.confirm within a drawer.

I've tried using:

Modal.confirm({
    mask: false,
    title: 'Confirm',
    content: 'Bla bla ...',
    okText: 'test',
    cancelText: 'test',
    getContainer: () => document.getElementsByClassName('ant-drawer-body'),
  })

Nothing appears when the drawer is opened and no errors are displayed in console.

https://www.antdv.com/components/drawer/ https://www.antdv.com/components/modal/

Also tried with:

getContainer: () => document.getElementsByClassName('ant-drawer-content')[0]

and it appears that the modal opens in the center of the drawer at first when the drawer opens, but immediately centers to the page after.

dataviews
  • 2,466
  • 7
  • 31
  • 64
  • 1
    I'm not super familiar with ant, but I will say that if you only one the very first item, you should use `querySelector` and not `getElementsByClassName` so you're not getting an array of elements back. – Ohgodwhy Dec 06 '20 at 06:57
  • Does this answer your question? [show antd modal mask in some div](https://stackoverflow.com/questions/58398456/show-antd-modal-mask-in-some-div) – Andrey Nov 24 '21 at 13:00

0 Answers0