SPA nav improvements: scroll restoration, popstate, history spec
- boot.sx: popstate handler extracts scrollY from history state - engine.sx: pass scroll position to handle-popstate - boot-helpers.sx: scroll position tracking in navigation - orchestration.sx: scroll state management for back/forward nav - history.spec.js: new Playwright spec for history navigation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
10
web/boot.sx
10
web/boot.sx
@@ -433,7 +433,15 @@
|
||||
(run-post-render-hooks)
|
||||
(flush-collected-styles)
|
||||
(set-timeout (fn () (process-elements nil)) 0)
|
||||
(dom-listen (dom-window) "popstate" (fn (e) (handle-popstate 0)))
|
||||
(dom-listen
|
||||
(dom-window)
|
||||
"popstate"
|
||||
(fn
|
||||
(e)
|
||||
(let
|
||||
((state (host-get e "state"))
|
||||
(scrollY (if state (or (dict-get state "scrollY") 0) 0)))
|
||||
(handle-popstate scrollY))))
|
||||
(dom-set-attr
|
||||
(host-get (dom-document) "documentElement")
|
||||
"data-sx-ready"
|
||||
|
||||
Reference in New Issue
Block a user