How do I reopen a Custom UI Modal?

I’m developing a Confluence global page using Forge Custom UI.

I have programmed to open a Modal when an element is clicked.
I can’t reopen the Modal as shown below.
Step 1: Click on the element to open the Modal.
Step 2: Click outside the Modal to close the Modal.
Step 3: When I click on the element again, the Modal does not open. (It was called open())

The source code is as follows
manifest.yml

resources:
  - key: main
    path: static/main/build
  - key: modal-resource
    path: static/modal-resource/build

App.js of main resource(No change other files of main resource)

import React from 'react';
import { Modal } from '@forge/bridge';

function App() {
	const modal = new Modal({
			resource: 'modal-resource',
			onClose: (payload) => {
				console.log('onClose called with', payload);
			},
			size: 'medium',
			context: {
				customKey: 'custom-value',
			},
		});

	function handleClick(e) {
		e.preventDefault();
		modal.open();
		console.log('Clicked.');
	}

	return (
		<div class='open-button' onClick={handleClick}>
			Open a modal.
		</div>
	);
}

export default App;

App.js of modal-resource(Other files have the same configuration as files of main resouce)

import React from 'react';
import { view } from '@forge/bridge';

function App() {
	function handleClick(e) {
		e.preventDefault();
		view.close();
	}

	return (
		<div class="close-button" onClick={handleClick}>
			Close on click here.
		</div>
	);
}

export default App;

If you have any suggestions, please let me know.

Thanks.

1 Like

Hi @tosh,

I’ve been able to reproduce the behaviour you’re describing if I have my system preference set to “Reduce motion”. We’ll need to fix this on our side.

Can you let me know if you have reduced motion on or not? If you don’t have it on, I’ll need to do some more digging to figure out why this isn’t working for you.

2 Likes

Hi @RyanBraganza ,

I had motion reduction turned on in the Windows OS settings.
I also confirmed that with motion reduction off, I can reopen the Modal.

Thanks!

1 Like

Thanks for the conformation @tosh, I’ve created [FRGE-646] - Ecosystem Jira for tracking purposes.

2 Likes

Thank you for creating a Jira issue, @RyanBraganza .
I will be happy when that issue is resolved.