Make a real scrollIntoView call on the teacher’s exercise sheet: block and inline, which containers scroll along, a sticky title and scroll-padding, and…
"Jump to section", the latest chat message, the form field with an error, a highlighted search hit: they all need scrolling to an element. Without scrollIntoView you work out offsetTop and scrollTop yourself in every container, and it is easy to get wrong.
scrollIntoView scrolls every container, up to the window
scrollIntoView scrolls one container only It scrolls every scrollable ancestor up to the browser window, so the page can jump too. For one container only: container: 'nearest' (newer browsers), or container.scrollTo({ top: el.offsetTop }) with the container position: relative.behavior: 'smooth' is not smooth, it jumps instead Another scroll on the way cuts it: a focus() after it (use focus({ preventScroll: true })), a second call, or a scrollTop being set. A browser setting can turn smooth scrolling off, and your own code should pick auto for prefers-reduced-motion: reduce. CSS scroll-behavior only applies to behavior: 'auto'.scrollIntoView before the element is rendered querySelector (or ref.current) is still null, and null.scrollIntoView() throws a TypeError. Call it after the data has rendered: in React, in a useEffect that depends on the data.block: 'start' on exercise 9 The board writes the shelf, the page and the browser window: all three move.block: 'nearest' Nothing moves: nearest only scrolls when it must.scroll-padding-top, then block: 'start' The exercise stops under the sticky title, no longer covered.behavior: 'smooth' The board counts the frames it glides for (without prefers-reduced-motion).