Imagine a page with two side-by-side <div>
elements like https://nodejs.org/dist/latest-v12.x/docs/api/.
The <div>
on the left navigates between pages. The one on the right has the actual content.
When I press space
(spacebar), the browser advances the content of the right-hand <div>
by one screenful, reminiscent of the traditional UNIX pager more
. (IIRC, this has been fairly standard browser behavior since NCSA Mosaic.)
However, sometimes I want to scroll the column on the left (the "navigation" column). How does the browser decide which column to scroll when space
is pressed? The document.activeElement
is <body>
, an ancestor of both of those column <div>
elements. I want to be able to change the focus using a bookmarklet (or extension)—which I will be happy to write myself, but this mechanism seems not to be governed by HTMLElement.focus()
in any way that I understand.
position:fixed
which pins it in the viewport so the right is the only part that scrolls with the window through default behavior as you suggested