Skip to content

fix(ui): use scroll:'manual' in intercept to honor rmx-reset-scroll=false - #11644

Draft
okxint wants to merge 1 commit into
remix-run:mainfrom
okxint:fix/reset-scroll-intercept-manual
Draft

fix(ui): use scroll:'manual' in intercept to honor rmx-reset-scroll=false#11644
okxint wants to merge 1 commit into
remix-run:mainfrom
okxint:fix/reset-scroll-intercept-manual

Conversation

@okxint

@okxint okxint commented Jul 25, 2026

Copy link
Copy Markdown

rmx-reset-scroll="false" has no effect. Even though state.resetScroll is correctly parsed to false, the page still scrolls to the top on navigation.

Root cause: event.intercept() defaults to scroll: 'after-transition', which tells the browser to automatically scroll to the top after the handler promise resolves — regardless of any manual scroll calls inside the handler. The guard on state.resetScroll only suppresses the manual window.scrollTo(0, 0) call; the browser's built-in automatic scroll runs unconditionally.

Fix: Pass scroll: 'manual' to event.intercept(). This delegates all scroll responsibility to the handler, which already has the correct if (state.resetScroll && isNewEntry) guard in place.

event.intercept({
  scroll: 'manual',  // ← added
  async handler() {
    // ...
    if (state.resetScroll && isNewEntry) {
      window.scrollTo(0, 0)  // only fires when resetScroll is true
    }
  },
})

No other changes needed — the existing manual scroll logic was already correct; it just wasn't the only scroll source.

Fixes #11617

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: rmx-reset-scroll="false" doesn't work

1 participant