Scroll up on hash change

This commit is contained in:
Standa Lukeš 2020-10-17 20:18:54 +00:00
parent 48743d936e
commit e4d27070b9
3 changed files with 6 additions and 6 deletions

View file

@ -53,7 +53,7 @@ function plugins(editor) {
inlineSources: !halfProduction inlineSources: !halfProduction
}), }),
replace({ replace({
"allowEditor": false, "allowEditor": editor,
}), }),
// In dev mode, call `npm run start` once // In dev mode, call `npm run start` once

View file

@ -11,6 +11,11 @@
let hash = window.location.hash.substr(1); let hash = window.location.hash.substr(1);
window.onhashchange = () => { window.onhashchange = () => {
hash = window.location.hash.substr(1); hash = window.location.hash.substr(1);
window.setTimeout(() => window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
}), 50)
}; };
$: selectedTaskId = (/^task\/([^\/]*)/.exec(hash) || [null, null])[1]; $: selectedTaskId = (/^task\/([^\/]*)/.exec(hash) || [null, null])[1];
</script> </script>

View file

@ -26,11 +26,6 @@ import { taskStatuses } from "./task-status-cache";
function close() { function close() {
heightClass = "closed" heightClass = "closed"
window.setTimeout(() => window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
}), 100)
location.hash = "" location.hash = ""
} }