🔧 AI Nachrichten Evernote 11.30.6(24.08.2026 um 17:14 Uhr)
🔧 AI Nachrichten Speed Limiters, Short Cables, and Other EV Road Trip Revelations(26.08.2026 um 21:51 Uhr)
🔧 AI Nachrichten Hands-On with ChatGPT Work’s New Cloud Browser Feature(26.08.2026 um 17:06 Uhr)
🔧 AI Nachrichten Anthropic Introduces an In-App Browser for Claude Cowork(27.08.2026 um 16:18 Uhr)
🔧 AI Nachrichten Monthly Log: August 2026(31.08.2026 um 16:24 Uhr)
🔧 AI Nachrichten Inside OpenAI’s Codex with Andrew Ambrosino(31.08.2026 um 17:26 Uhr)
🎥 PodcastsDesigned in California Makes Its Official Debut(03.09.2026 um 17:59 Uhr)
🔧 AI Nachrichten Evernote 11.30.6(24.08.2026 um 17:14 Uhr)
🔧 AI Nachrichten Speed Limiters, Short Cables, and Other EV Road Trip Revelations(26.08.2026 um 21:51 Uhr)
🔧 AI Nachrichten Hands-On with ChatGPT Work’s New Cloud Browser Feature(26.08.2026 um 17:06 Uhr)
🔧 AI Nachrichten Anthropic Introduces an In-App Browser for Claude Cowork(27.08.2026 um 16:18 Uhr)
🔧 AI Nachrichten Monthly Log: August 2026(31.08.2026 um 16:24 Uhr)
🔧 AI Nachrichten Inside OpenAI’s Codex with Andrew Ambrosino(31.08.2026 um 17:26 Uhr)
🎥 PodcastsDesigned in California Makes Its Official Debut(03.09.2026 um 17:59 Uhr)

26 🕛 kürzlich 9 Min Lesezeit CVE-RADAR
0

Scroll Restoration After Micro-Frontend Redirects: Double RAF + MutationObserver

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

When building a micro-frontend app, I ran into a deceptively simple requirement: after a user triggers an external redirect (OAuth, payment flow, etc.) and returns to the page, scroll back to the element they were interacting with.



My first instinct was "just save the position and scroll back." That turned out to be wrong.



The real insight: this is a timing problem, not a scroll problem. Three things must happen in sequence, each at the correct moment in the browser's rendering pipeline. Once I mapped this out, every technical decision fell into place.









Part 1: The Map — Browser Event Loop



Before any solution, let's build the map. One iteration of the browser event loop runs in four phases:





MutationObserver's callback fires after appendChild but before the next paint — the earliest possible moment to detect the new node. setInterval can't guarantee landing in this precise window.



Important: at this point, the node exists in the DOM but has not been painted yet. Those are two different things, and the gap between them is exactly what Step 3 handles.






Step 3: Wait for the Element to Be Painted



This is the easiest step to get wrong.



Whether you find the element in useEffect directly (fast path) or via MutationObserver (slow path), at the moment of discovery the element is in the DOM but not yet painted. Calling scrollIntoView immediately forces the browser to synchronously compute Layout before it's finished — a forced reflow. The result is inconsistent and potentially inaccurate positioning.



The candidates for "wait until painted":






  • Vollständiger Original-Bericht
    Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
    ↗ Original-Artikel auf dev.to lesen
    Wie bewertest du diesen Beitrag?
    1 Klick Feedback
    Teilen mit Netzwerk & Team:

    Community-Analysen & Experten-Meinungen 0

    Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
    Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
    Community Pulse: Relevanz-Einschätzung
    1 Klick Experten-Votum
    🔴 Akute Relevanz 52%
    🟡 In Evaluierung 33%
    🟢 Keine Auswirkung 10%
    Spannende Innovation 5%
    Verwandte Story-Cluster & Quellen (Vektor-KI)
    Port 8095 Engine
    2 Quellen
    Hands-On with ChatGPT Work’s New Cloud Browser Feature
    1 Quelle
    Evernote 11.30.6
    1 Quelle
    Speed Limiters, Short Cables, and Other EV Road Trip Revelations
    Ähnliche Beiträge
    🔍 Verwandte News

    Auch interessante Nachrichten Scroll Restoration After Micro-Frontend Redirects: Double RAF + MutationObserver

    Thematisch verwandte Begriffe: Scroll, Restoration, After, MicroFrontend · 6 Treffer

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...