accessibility-checker-engine
Version:
An automated accessibility checking engine for use by other tools
50 lines (49 loc) • 2.56 kB
TypeScript
import { NavigationMode } from "./SRTypes";
import { SRCursor, SRCursorMatchFunc, SRCursorSkipFunc } from "./SRCursor";
export declare namespace SRNavigator {
/**
* Get the match function for identifying start positions in a given navigation mode
* @param mode The navigation mode (e.g., "link", "heading", "button", etc.)
* @returns A function that matches elements appropriate for the navigation mode
*/
function getStartFunc(mode: NavigationMode): SRCursorMatchFunc;
/**
* Get the skip function for a given navigation mode
* @param mode The navigation mode
* @returns A function that determines which nodes to skip during navigation
*/
function getSkipFunc(mode: NavigationMode): SRCursorSkipFunc;
/**
* Jump to the current position or the previous matching element if current doesn't match
* @param mode The navigation mode
* @param walker The cursor at the current position
* @returns A cursor at the current or previous matching position
*/
function jumpCurrent(mode: NavigationMode, walker: SRCursor): SRCursor;
/**
* Jump to the end of the current element and return all intermediate item positions
* @param mode The navigation mode
* @param walker The cursor at the current position
* @returns Array of cursors representing positions from current to end
*/
function jumpCurrentEnd(mode: NavigationMode, walker: SRCursor): SRCursor[];
/**
* Jump to the next matching element in the given navigation mode
* @param mode The navigation mode
* @param walker The cursor at the current position
* @returns A cursor at the next matching position, or null if none found
*/
function jumpNext(mode: NavigationMode, walker: SRCursor): SRCursor;
/**
* Navigates to the previous element in screen reader navigation based on the specified mode.
*
* For tab_focus mode, this function attempts to move to the previous tabbable element by:
* 1. First trying to move backward using the mode's match and skip functions
* 2. If that fails, collecting all tab focus cursors and finding the previous one in the tab order
*
* @param mode - The navigation mode (e.g., "tab_focus") that determines how to navigate
* @param walker - The current cursor position in the screen reader navigation
* @returns A new cursor positioned at the previous element, or null if no previous element exists
*/
function jumpPrevious(mode: NavigationMode, walker: SRCursor): SRCursor;
}