AutoScroll into a specific view ain't working in safari ios 16

42 Views Asked by At

Application is in React JS and embedded in an IFRAME. The below snippets are working for all browsers except safari ios 16.

Whenever the user switches to a new page, I want the a specific view (an element at the top with id-empty_space) to be scrolled into automatically. So that, the user gets to see the top of the iframe each time.

It's easy to obtain this, in normal browser but the issue is arising as the app is inside an iframe.

  1. scrollIntoView(elem, { behavior: "smooth", block: "center", inline: "center" });

  2. window.scrollTo({ top: 0, }); document .getElementById("empty_space") ?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' });

  3. document .getElementById("empty_space") ?.scrollIntoView();

Tried all the above, but the view is not getting scrolled to that view automatically

0

There are 0 best solutions below