Skip to content

Commit

Permalink
Add double check for 'keepFocus' and 'noScroll' in goto to allow for …
Browse files Browse the repository at this point in the history
…backcompatibity (#7678)

* add double check for 'keepFocus' and 'noScroll' in goto to allow for backcompatibility

* change line endings

* Fix precedence of operators

* fix line endings again

* Change to add another parenthesis + fix line endings

* This should fix identation and line endings

* fix random formatting errors

* Apply suggestions from code review

* Create hot-keys-lick.md

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
paoloricciuti and Rich-Harris authored Nov 16, 2022
1 parent 56f2c51 commit a762a09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-keys-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sveltejs/kit": patch
---

Ignore presence of `keepfocus` and `noscroll` in `goto` options if correctly-cased options are also present
4 changes: 2 additions & 2 deletions packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,13 +1202,13 @@ export function create_client({ target, base, trailing_slash }) {

goto: (href, opts = {}) => {
// TODO remove for 1.0
if ('keepfocus' in opts) {
if ('keepfocus' in opts && !('keepFocus' in opts)) {
throw new Error(
'`keepfocus` has been renamed to `keepFocus` (note the difference in casing)'
);
}

if ('noscroll' in opts) {
if ('noscroll' in opts && !('noScroll' in opts)) {
throw new Error(
'`noscroll` has been renamed to `noScroll` (note the difference in casing)'
);
Expand Down

0 comments on commit a762a09

Please sign in to comment.