Skip to content

Commit 94c8adf

Browse files
committed
Fix image gallery scrolling in editor on Safari
Safari (tested with 17.3) also triggers the observer callback for children whose `intersectionRatio` is below the threshold. This only happens inside the editor iframe. In the preview or published entries, the behavior matches Chrome and Firefox. We need to double check `intersectionRatio` ourselves to prevent invoking the `onVisibleIndexChange` callback for all of the children, which leads to a broken image gallery. REDMINE-20635
1 parent 2b49d8a commit 94c8adf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

entry_types/scrolled/package/src/contentElements/imageGallery/useIntersectionObserver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function useIntersectionObserver({threshold, onVisibleIndexChange}) {
1414
(child) => child === entry.target
1515
);
1616

17-
if (entry.isIntersecting) {
17+
if (entry.isIntersecting && entry.intersectionRatio >= threshold) {
1818
onVisibleIndexChange(entryIndex);
1919
}
2020
});

0 commit comments

Comments
 (0)