Dear @Louis, thank you for your hardwork,
I finally found out more precisely the context of the issue I have with sharing the lightbox between galleries/images/etc…
I built a post with the featured image, a few static images, a static gallery, a ACF image, and ACF gallery.
To all these images, either by using the gallery link/lighbox or wrapping a div around the image and adding a link/action/lighbox I created a shared lightbox between all these elements using a single lighbox ID.
Thanks to your update it works great, in almost every case.
There is still one case in which it doesn’t work, and only in one direction:
When I click on any image outside of the ACF gallery, they are all connected in the lighbox but the images in the acf gallery.
If I click on one image in the acf gallery though, all the images in the page are connected through the lightbox.
It is almost perfect
Thank you in advance for checing this out…