Force instant scroll on SPA navigation
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -676,13 +676,14 @@ class Spa {
|
||||
// Scroll Restoration #1: Immediate (after action starts)
|
||||
// This occurs synchronously after the action component is created
|
||||
// May fail if page height is insufficient - that's okay, we'll retry later
|
||||
// Use behavior: 'instant' to override Bootstrap's scroll-behavior: smooth on :root
|
||||
if (opts.scroll) {
|
||||
console_debug('Spa', 'Restoring scroll position (immediate): ' + opts.scroll.x + ', ' + opts.scroll.y);
|
||||
window.scrollTo(opts.scroll.x, opts.scroll.y);
|
||||
window.scrollTo({ left: opts.scroll.x, top: opts.scroll.y, behavior: 'instant' });
|
||||
} else if (opts.scroll === undefined) {
|
||||
// Default: scroll to top for new navigation (only if scroll not explicitly set)
|
||||
console_debug('Spa', 'Scrolling to top (new navigation)');
|
||||
window.scrollTo(0, 0);
|
||||
window.scrollTo({ left: 0, top: 0, behavior: 'instant' });
|
||||
}
|
||||
// If opts.scroll === null, don't scroll (let Navigation API or browser handle it)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user