UNPKG

@funidata/ngx-fudis

Version:

Funidata Design System.

50 lines (49 loc) 1.62 kB
import * as i0 from "@angular/core"; export declare class FudisFocusService { private _document; constructor(_document: Document); /** * List of ignored id's */ private _ignoreInitialFocusList; /** * HTML element to focus */ private _focusTarget; /** * Get target HTML element to focus */ getFocusTarget(): HTMLElement; /** * Set focus target if it's not alert close button */ setFocusTarget(target: HTMLElement): void; /** * Focus target element by id. If focusable element is not available when function is called, it * will repeatively call itself until try counter is full. * * @param id Target to focus * @param tryCounter How many times function should try to focus to given id */ focusToElementById(id: string, numberOfTries?: number): void; /** * Add component with given id to ignore list, so that initialFocus is ignored with that. Used * e.g. in a form where same component is added multiple times when user clicks 'New item' or * similar and focus is wanted to move there except with 'item-id-x'. */ addToIgnoreList(id: string): void; /** * Remove id from ignore initialFocus list */ removeFromIgnoreList(id: string): void; /** * Get list of ignored id's */ getIgnoreList(): string[]; /** * Check if current id is in the ignored list */ isIgnored(id: string): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<FudisFocusService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<FudisFocusService>; }