Skip to content

Commit

Permalink
labsite: Improve scrolling on Next click
Browse files Browse the repository at this point in the history
Improve the scrolling experience on Next button click: We now always scroll the
next button to the top of the page with the top edge a little clipped. Smooth
scrolling is also enabled, so it should hopefully be more obvious what's going
on when clicking on the next button. Unfortunately smooth scrolling doesn't
seem to work on my linux machine in Firefox or Chrome, but it seem ok on MacOS
and iOS.
  • Loading branch information
juliaogris committed Aug 26, 2024
1 parent 5458eb5 commit fb3fb7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions frontend/lab/css/overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ html {
height: 100%;
padding: 8px 16px var(--editor-padding-bottom) 16px;
scroll-behavior: smooth;
position: relative;
}
.notes:after {
content: "";
display: block;
height: 80%;
}

@media (min-width: 768px) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/play/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function handleNotesNextClick(e) {
if (el.querySelector(".next-btn")) break
el = el.nextElementSibling
}
btn.nextElementSibling?.scrollIntoView({ behavior: "smooth" })
document.querySelector("#notes").scrollTo({ top: btn.offsetTop + 8, behavior: "smooth" })
}

function updateEditor(content, opts) {
Expand Down

0 comments on commit fb3fb7b

Please sign in to comment.