import './modal.scss';

document.addEventListener("dialog:aftercreate", (event) => {
  const dialog = event.dialog;
  if (!dialog) return;

  // Add click handler to overlay to close dialog
  const overlay = document.querySelector('.ui-widget-overlay');
  if (!overlay) return;

  overlay.addEventListener('click', () => {
    dialog.close();
  });

})
