Modal dialog from custom-ui

I’m trying to trigger a Modal from a custom UI Macro. I started with my code as:


open()
	{
		const modal = new Modal(
		{
			resource: 'lean-coffee-resource',
			onClose: (payload) => {
				console.log('onClose called with', payload);
			},
			size: 'large'
		});

		modal.open();
	}

Even when I “clean” up the code and remove the optional code:


open()
	{
		const modal = new Modal(
		{
		});

		modal.open();
	}

I can’t seem to get the modal open. I do get an error message with “Error: Unable to open modal.” but I have no clue why it’s not working…

1 Like

Dumb question, is the page in edit mode when you get this error?

Page is in view mode. :frowning:

1 Like

Just tried from a confluence:spacePage module and the same code (above) works there. Are Modal dialogs not supported in Macros?

1 Like

Hi @danielwester, there appears to be an issue with modals opening in Confluence macros. The team is currently working on a fix.

Is there a timeframe for the fix? Is it within the next 3 months or whenever they have time type of thing?

It’ll be done within the next month.

1 Like