Closed lovasoa closed 2 years ago
I was not able to run your example. After doing npm install
and then npm run dev
, I get:
performance is not defined
ReferenceError: performance is not defined
The code requires node >=16. Are you on the latest version of node ?
There is also a Dockerfile provided if you don't want to install anything locally.
Ok, I switched to Node 16 and it runs now, but I can't reproduce it. Could it possible be a race condition? Can you explain more about what you believe the cause of the issue is?
To help with reproduction, here is my npm ls :
sanipasse@1.0 /workspaces/sanipasse
βββ @ctrl/ts-base32@1.2.6
βββ @peculiar/x509@1.3.2
βββ @sveltejs/adapter-node@1.0.0-next.33
βββ @sveltejs/adapter-static@1.0.0-next.13
βββ @sveltejs/kit@1.0.0-next.127
βββ @types/pako@1.0.2
βββ @typescript-eslint/eslint-plugin@4.28.3
βββ @typescript-eslint/parser@4.28.3
βββ @zxing/browser@0.0.9
βββ @zxing/library@0.18.6
βββ ajv@8.6.1
βββ base45-ts@1.0.3
βββ base64-js@1.5.1
βββ bignumber.js@9.0.1
βββ bootstrap-icons@1.5.0
βββ bootstrap@5.0.2
βββ buffer@6.0.3
βββ cbor-web@7.0.6
βββ cbor@7.0.6
βββ cosette@0.6.1
βββ eslint-config-prettier@8.3.0
βββ eslint-plugin-svelte3@3.2.0
βββ eslint@7.30.0
βββ isomorphic-webcrypto@2.3.8
βββ localforage@1.9.0
βββ node-fetch@2.6.1
βββ pako@2.0.3
βββ pdfjs-dist@2.8.335
βββ prettier-plugin-svelte@2.3.1
βββ prettier@2.2.1
βββ sequelize@6.6.5
βββ sqlite3@5.0.2
βββ svelte-check@1.6.0
βββ svelte-preprocess@4.7.4
βββ svelte@3.38.3
βββ sveltestrap@5.4.0
βββ tslib@2.3.0
βββ typescript@4.3.5
βββ workbox-precaching@6.1.5
βββ workbox-recipes@6.1.5
When placing a breakpoint on deep_linked.scrollIntoView();
in router.js
. I can see that it is being called while the contents of the old page (the one on which the |<a>
tag is) is still in the dom and and displayed on screen when it is called.
@benmccann : my website https://sanipasse.fr/ uses multiple internal hash links and suffers from this bug. What are the next steps towards fixing it ? Do you need any further information from me ?
No longer reproducible. The code in question now has await tick()
before it which should give enough time to rerender the components so scrolling works.
Describe the bug
Hash links do not always scroll to the right position in the target page.
Reproduction
Here is a repo that reproduces the bug: https://github.com/lovasoa/sanipasse
From the root of the repo, run
npm run dev
, then on http://localhost:3000 click the first link ("strictement privΓ©e"). You'll end up at the bottom of the page on http://localhost:3000/apropos#donnees instead of scrolling to the right heading ("π Protection des donnΓ©es personnelles"). You can see that svelte's scrolling behavior is incorrect by comparing the same link when opened in a new tab.Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
By adding a breakpoint on
in svelte's router.js you see where the problem is. The call to
scrollIntoView
happens before the contents from the old page are removed from the DOM.