up.viewport
Features to control scrolling and focus when fragments are updated.
The default viewport is the document's scrolling element. Mark additional scrolling containers, like a pane that scrolls on its own, with [up-viewport] so Unpoly can scroll them when revealing an element and save their scroll positions for history restoration. Elements fixed to the screen edge, like a sticky header, get [up-fixed=top] so revealed content is not hidden behind them.
From JavaScript, up.reveal() scrolls an element into view, and up.viewport.saveScroll() and up.viewport.restoreScroll() save and restore scroll positions. Defaults like the reveal padding live in up.viewport.config.
Marks this element as being anchored to the right edge of the screen, like a fixed navigation bar.
Marks this element as being fixed to the bottom edge of the screen
using position: fixed.
Marks this element as being fixed to the top edge of the screen
using position: fixed.
Focuses the given element.
This class is assigned to elements that were focused by Unpoly but should not have a visible focus ring.
This class is assigned to elements that were focused by Unpoly and should have a visible focus ring.
Scrolls the given element's viewport so the first rows of the element are visible for the user.
Scrolls the given viewport to the given Y-position.
This class is assigned to the <body> and right-anchored
elements while an overlay with a scrolling viewport is open.
Marks this element as a scrolling container ("viewport").
Returns the scrolling container for the given element.
Configures defaults for scrolling.
Returns the scrolling container for the given element.
Restores previously saved focus-related state.
Restores previously saved scroll positions.
Returns the scrolling element for the browser's main content area.
Saves focus-related state for later restoration.
Saves scroll positions for later restoration.
Tip Your coding agent can search these docs locally with the Unpoly agent skill