Skip to content

fix(pages): preserve scroll after action submissions - #703

Merged
cpojer merged 2 commits into
voidzero-dev:mainfrom
Dazzanova:fix/action-preserve-scroll
Nov 4, 2026
Merged

cpojer merged 2 commits into
voidzero-dev:mainfrom
Dazzanova:fix/action-preserve-scroll

Conversation

@Dazzanova

Copy link
Copy Markdown
Contributor

Summary

Preserve the current scroll position after successful action() and useForm submissions.

Previously, action submissions called router.visit() without setting preserveScroll, causing the page to scroll to the top after navigation.

This change:

  • Defaults preserveScroll to true in the shared submitAction() function.
  • Allows callers to explicitly disable scroll preservation with preserveScroll: false.
  • Adds regression tests covering both default behavior and explicit overrides.
  • Updates existing action-client tests to account for the new default.

Testing

  • Local test suite passes.
  • Added tests for default scroll preservation.
  • Added test for explicitly disabling scroll preservation.

closes #700

@cpojer

cpojer commented Nov 4, 2026

Copy link
Copy Markdown
Member

Thank you!

@cpojer
cpojer merged commit ec13839 into voidzero-dev:main Nov 4, 2026
2 checks passed
@Dazzanova
Dazzanova deleted the fix/action-preserve-scroll branch November 4, 2026 15:08
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.

Keep the scroll position after action() and useForm submissions

2 participants