Skip to content

Conversation

@kanikaa88
Copy link

Summary

Fixes content jumping issue when scrolling on Opera browser on iPhone (reported in #7777).

Problem

Opera on iPhone has similar scroll behavior to Safari, but wasn't being detected in the scroll restoration logic. This caused content to jump up and down when scrolling.

Before fix:
Before - Content jumping

Solution

Added Opera browser detection to the scroll restoration logic in _app.tsx. Opera now gets the same treatment as Safari - setting history.scrollRestoration = 'auto' to prevent the scroll jumping issue.

Changes

  • Added Opera detection using /OPR|Opera/i regex pattern (line 39)
  • Applied same scroll restoration fix for Opera as Safari (line 40)
  • Updated comments to reflect Opera support

Testing

Verified Opera detection:
Screenshot 2026-01-16 at 7 52 42 PM

Console showing scrollRestoration = 'auto'

Tested scrolling behavior:

  • Scrolled on the problematic page on OPERA : http://localhost:3000/blog/2025/04/23/react-labs-view-transitions-activity-and-more
  • No content jumping observed
  • Smooth scrolling behavior confirmed

✅ Follows the same pattern as the existing Safari fix, which has been working well

After fix:

Screen.Recording.2026-01-16.at.7.50.58.PM.mov
Screenshot 2026-01-16 at 7 52 18 PM Screenshot 2026-01-16 at 7 52 42 PM

Fixes #7777

Improve the explanation in the 'Fetching data' section to clearly
distinguish when an Effect is needed (synchronization with external
system) versus when it's not needed (user events, data transformation).

Closes reactjs#8226
Add Opera browser detection to scroll restoration logic to fix
content jumping issue when scrolling on Opera on iPhone.

Opera has similar scroll behavior to Safari and needs the same
scroll restoration fix. This sets history.scrollRestoration to
'auto' for Opera browsers, preventing the content jumping issue.

Fixes reactjs#7777
@github-actions
Copy link

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 110.57 KB (🟡 +21 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Content jumping up and down when scrolling

1 participant