ITADN

rename `noScroll` and `keepFocus` options

#16479OpenRich-Harris 创建于 2026-07-23
breaking change
R
Rich-Harriscommented
### Describe the problem Context here: https://github.com/sveltejs/kit/pull/16449#discussion_r3634130236. Please no PRs for this until that one is merged. Basically, `goto(url, { keepFocus: true })` is a lie. It means 'don't focus the `<body>`, but it doesn't actively _keep_ the focus — something on the new page might change it to something entirely different. The addition of the `shallow: true` option in #16449 magnifies this issue by defaulting `keepFocus` to `true`, even though a common use case is opening a modal which definitely _should_ update the focused element. And next to `keepFocus`, the `noScroll` name is weird. Names that describe what _doesn't_ happen are bad at the best of times, but having a modifier like `no` alongside a verb like `keep` is unforgivable. We should try to use active (and more consistent) language. ### Describe the proposed solution ```js goto(url, { resetFocus: false, resetScroll: false }); ``` Both options would default to `true`, except in the `shallow: true` case in which they would default to `false`. ### Alternatives considered _No response_ ### Importance nice to have ### Additional Information _No response_
2 条评论