@blox/material
Version:
Material Components for Angular
33 lines (32 loc) • 1.57 kB
TypeScript
import { ElementRef, OnDestroy } from '@angular/core';
import { AbstractMdcFocusTrap, AbstractMdcFocusInitial, FocusTrapHandle } from './abstract.mdc.focus-trap';
/**
* When placed on a child element of an <code>mdcFocusTrap</code>, the focus trap
* will try to move focus to this element when the focus trap is activated.
*/
export declare class MdcFocusInitialDirective extends AbstractMdcFocusInitial {
_elm: ElementRef;
constructor(_elm: ElementRef);
}
/**
* Directive for trapping the tab key focus within an element. To be used
* for e.g. modal dialogs, where focus must be constrained for an accesssible experience.
*
* This will only trap the keyboard focus (when using tab or shift+tab). It will not prevent the focus from moving
* out of the trapped region due to mouse interaction. You can use a background scrim element that overlays
* the window to achieve that. (Like `mdcDialog` does).
*
* Use `mdcFocusInitial` on a child element if a specific element needs to get
* focus upon activation of the trap. In the absense of an `mdcFocusInitial`,
* or when that element can't be focused, the focus trap will activate the first tabbable
* child element of the focus trap.
*/
export declare class MdcFocusTrapDirective extends AbstractMdcFocusTrap implements OnDestroy {
private _elm;
private trap;
constructor(_elm: ElementRef);
ngOnDestroy(): void;
/** @docs-private */
trapFocus(): FocusTrapHandle;
}
export declare const FOCUS_TRAP_DIRECTIVES: (typeof MdcFocusInitialDirective | typeof MdcFocusTrapDirective)[];