/** * Give an element focus without letting the page jump to it. * * Focusing normally asks the browser to bring the element into view, and that * is the right default for a page's own content. It is never right here: the * widget is `position: fixed` and already where the reader can see it, so any * scrolling that happens is the page being yanked around for nothing. * * It looks like it could not happen — a fixed box is always in view — but the * moment an ancestor has a `transform`, a `filter`, or `will-change` (an * animation wrapper, a page-transition container, half of the SPA shells out * there), `fixed` is measured against that ancestor instead of the viewport. * The widget then sits wherever that box ends, which may be thousands of * pixels down the document, and opening the panel scrolls the reader there. * The same happens inside an iframe, where the outer page scrolls the frame * into view. * * `preventScroll` says exactly that, and every browser this library supports * honours it. The reading and restoring around it is for the ones that do not: * the scroll they cause is synchronous, so putting the positions back on the * same turn means nothing is ever painted in the wrong place. * * @param {HTMLElement | null | undefined} element * @returns {boolean} True when there was something to focus. */ export function focusWithoutScrolling(element: HTMLElement | null | undefined): boolean;