There is 1 update, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-0d76f921-19ed-433f-8dd4-b39bb5d44470 XWIKI-24906 Open

Javascript event for when the macro modal is opened or a parameter is loaded

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-a55885c5-feab-46d4-ba34-1a3c43f07109 Changes by Farcasi Alexandru-Vicentiu on 15/Sep/26 13:52
 
Summary: Javascript event for when the macro modal is opened or a parameter is loaded
 
 

1 comment

 
cid:jira-generated-image-avatar-a55885c5-feab-46d4-ba34-1a3c43f07109 Farcasi Alexandru-Vicentiu on 15/Sep/26 13:52
 

Hello Manuel Leduc!
The underlying issue is about executing JavaScript code at the exact moment a parameter is displayed. Right now there are a few cases that need to be considered: when the modal opens for the first time, when it is closed, and when it is reopened immediately afterward. In jQuery, the code needs to run both when the script initializes and when the modal opens, since it's not always clear when the input actually becomes visible. Also, on newer versions, the "shown.bs.modal" event stopped being reliable because the input wasn't yet visible by the time the event fired, so a MutationObserver had to be used instead to detect when the input actually became visible.
AFAIK you can find an example of the problem here:
https://github.com/xwikisas/project-management/blob/59a0a64120034fa56e366301a55fda9e9bc763a6/project-management-openproject/project-management-openproject-macro/src/main/resources/openproject/js/projectSelect.js#L143