discourse/app/assets
David Battersby 351e8e2359
FIX: capture click target in lightbox click handler (#22732)
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.
2023-07-21 12:28:37 +08:00
..
images
javascripts FIX: capture click target in lightbox click handler (#22732) 2023-07-21 12:28:37 +08:00
stylesheets FEATURE: Regenerate outdated summaries. (#22718) 2023-07-20 15:25:46 -03:00