office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
66 lines (65 loc) • 2.82 kB
TypeScript
/// <reference types="react" />
import { IFocusZone, IFocusZoneProps } from './FocusZone.types';
import { BaseComponent } from '../../Utilities';
export declare class FocusZone extends BaseComponent<IFocusZoneProps, {}> implements IFocusZone {
static defaultProps: IFocusZoneProps;
private _root;
private _id;
/** The most recently focused child element. */
private _activeElement;
/** The child element with tabindex=0. */
private _defaultFocusElement;
private _focusAlignment;
private _isInnerZone;
/** Used to allow us to move to next focusable element even when we're focusing on a input element when pressing tab */
private _processingTabKey;
constructor(props: IFocusZoneProps);
componentDidMount(): void;
componentWillUnmount(): void;
render(): JSX.Element;
/**
* Sets focus to the first tabbable item in the zone.
* @param {boolean} forceIntoFirstElement If true, focus will be forced into the first element, even if focus is already in the focus zone.
* @returns True if focus could be set to an active element, false if no operation was taken.
*/
focus(forceIntoFirstElement?: boolean): boolean;
/**
* Sets focus to a specific child element within the zone. This can be used in conjunction with
* onBeforeFocus to created delayed focus scenarios (like animate the scroll position to the correct
* location and then focus.)
* @param {HTMLElement} element The child element within the zone to focus.
* @returns True if focus could be set to an active element, false if no operation was taken.
*/
focusElement(element: HTMLElement): boolean;
private _onFocus;
/**
* Handle global tab presses so that we can patch tabindexes on the fly.
*/
private _onKeyDownCapture(ev);
private _onMouseDown;
private _setActiveElement(element, forceAlignemnt?);
/**
* Handle the keystrokes.
*/
private _onKeyDown;
/**
* Walk up the dom try to find a focusable element.
*/
private _tryInvokeClickForFocusable(target);
/**
* Traverse to find first child zone.
*/
private _getFirstInnerZone(rootElement?);
private _moveFocus(isForward, getDistanceFromCenter, ev?, useDefaultWrap?);
private _moveFocusDown();
private _moveFocusUp();
private _moveFocusLeft();
private _moveFocusRight();
private _setFocusAlignment(element, isHorizontal?, isVertical?);
private _isImmediateDescendantOfZone(element?);
private _getOwnerZone(element?);
private _updateTabIndexes(element?);
private _isElementInput(element);
private _shouldInputLoseFocus(element, isForward?);
private _shouldWrapFocus(element, noWrapDataAttribute);
}