Auto scroll on Safari | Community
Skip to main content
Answered

Auto scroll on Safari


  • New Participant
  • 2 replies

Hi!

It seems that there is an unwanted scroll behaviour when opening and closing intercom on Safari when there are messages in the message board.

It is easily replicable on your codepen’s test app: codepen.io/intercom/pen/QGqWxw

Open the link on Safari, scroll to the middle of the screen, open intercom, write a couple of messages, close the intercom and open it again, it auto scrolls up.

I’m a developer and I have this bug reported by our customers. Is there any way to stop this behaviour?

 

Thank you!


With regards,

Kenan

Best answer by Ebenezer.Laleye

Hi ​@kenan ! Ebenezer here from Engineering Support👋.

Based on our investigation and your description, the unwanted scroll behavior you’re seeing in Safari when toggling the Intercom Messenger could be related to how Safari handles focus and scroll restoration when overlays or iframes are shown and hidden. Specifically, when the Messenger is opened or closed, Safari may attempt to restore the scroll position or focus, but does so incorrectly, causing the page to scroll to the top. This behavior is more noticeable when there are existing messages in the Messenger, as it opens in a different state (message list) compared to when there are no messages (new message view).

 

At this time, this appears to be a browser-specific issue with Safari’s handling of overlays and iframes, rather than something caused by the Intercom Messenger’s integration code. As a workaround, you could try manually saving the scroll position before opening or closing the Messenger and restoring it afterwards using JavaScript. For example, you can use the Intercom('onShow', ...) and Intercom('onHide', ...) event hooks to implement this logic.

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+7

Hi ​@kenan ! Ebenezer here from Engineering Support👋.

Based on our investigation and your description, the unwanted scroll behavior you’re seeing in Safari when toggling the Intercom Messenger could be related to how Safari handles focus and scroll restoration when overlays or iframes are shown and hidden. Specifically, when the Messenger is opened or closed, Safari may attempt to restore the scroll position or focus, but does so incorrectly, causing the page to scroll to the top. This behavior is more noticeable when there are existing messages in the Messenger, as it opens in a different state (message list) compared to when there are no messages (new message view).

 

At this time, this appears to be a browser-specific issue with Safari’s handling of overlays and iframes, rather than something caused by the Intercom Messenger’s integration code. As a workaround, you could try manually saving the scroll position before opening or closing the Messenger and restoring it afterwards using JavaScript. For example, you can use the Intercom('onShow', ...) and Intercom('onHide', ...) event hooks to implement this logic.


  • Author
  • New Participant
  • 2 replies
  • June 30, 2025

Hi Ebenezer,

Thank you for your reply and suggestion. I’ll try the event hooks and see if that helps.

Regards,
Kenan


  • New Participant
  • 1 reply
  • July 12, 2025

Thanks for reporting this—you're right, the scroll behavior is reproducible on Safari. It looks like when the Intercom messenger is reopened, Safari resets the scroll position due to the focus event or DOM updates (Read More). This might be related to how Safari handles layout reflows. A possible workaround is to manually store the scroll position before opening the messenger and restore it after it loads. We’re looking into a more stable fix, but in the meantime, applying that scroll lock could help mitigate the issue. We'll keep you updated as we make progress on a permanent solution.


  • Author
  • New Participant
  • 2 replies
  • July 14, 2025

Hi!

Thank you for the reply! I ended up with implementing a workaround with handling scroll position like you and Ebenezer suggested. If you guys get a fix for this, please let me know,  I would greatly appreciate it!

Regards,

Kenan


Reply