mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 23:54:25 +08:00
351e8e2359
In Safari, clicking any image in a lightbox gallery results in the first image loading (instead of the clicked image). Previously we relied on document.activeElement to determine which lightbox image was clicked. However in Chrome the active element is the lightbox selector (a.lightbox), whereas in Safari the active element defaults to the body tag. Currently the startingIndex that is calculated within processHTML() is used by lightbox to determine which image to load first. The starting index is currently achieved by checking each lightbox element within the gallery against the active element. To fix this issue we can use the event.target to get the clicked image, then use the closest selector and pass that into the function to do the matching and return the correct startingIndex. |
||
---|---|---|
.. | ||
images | ||
javascripts | ||
stylesheets |