/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Keeping the keyboard in a region as the control it is on goes (#1398): an * inspector's Delete, Unplace, Remove or Place takes away what its view shows, * and a link in it selects something else — the view the control was pressed * in is drawn no more, and the focus, on a control that went with it, would * fall to the page's body, where the next Tab starts again at the page's top. * The region keeps it: once what it shows has been drawn again, the focus * lands on its view's home ({@link FOCUS_HOME}) — its heading, focusable by * script and out of the tab order — which names what the region shows now, so * a screen reader says where the keyboard is and the next Tab goes on from * there. A focus that left the region — for another element, for the page with * the control it was on still there, or a press anywhere outside it — is let * be. So is one on its way to another of the region's controls, still there — * a click into it, a Tab to it — though what the region shows is drawn again * meanwhile, as a field commits its edit while the keyboard leaves it: it * lands where it was given (#1585). * * Every builder's Details is such a region: the Schematic's, the Flowchart's, * the Plan's, the Calendar's, the Roster's and the Allocation's. A view's home * is its head; a view with none — the Plan's Nothing selected, the Calendar's * empty state — is its own. * * @packageDocumentation */ import { type FocusEvent, type RefObject } from "react"; /** What marks a region's home: the element the keyboard lands on as the control it was on goes. */ export declare const FOCUS_HOME = "data-focus-home"; /** A home's attributes, as a view's heading spreads them: out of the tab order, focusable by script. */ export declare const FOCUS_HOME_PROPS: { readonly tabIndex: -1; readonly "data-focus-home": ""; }; /** What a region's element spreads: its ref, and its focus and blur listeners. */ export interface FocusHomeRegion { /** The region's element. */ readonly ref: RefObject; /** Hears the focus enter the region, or move within it. */ readonly onFocus: () => void; /** Hears the focus leave an element of the region. */ readonly onBlur: (event: FocusEvent) => void; } /** * Keeps the keyboard in a region (see the module docs). * * @returns What the region's element spreads */ export declare function useFocusHome(): FocusHomeRegion; //# sourceMappingURL=focus-home.d.ts.map