@eclipse-scout/core
Version:
Eclipse Scout runtime
59 lines • 3.35 kB
TypeScript
/**
* Utility methods for focus.
*/
export declare const focusUtils: {
/**
* @returns whether the given element is focusable by mouse.
*/
isFocusableByMouse(element: HTMLElement | JQuery): boolean;
/**
* @returns whether the element must not gain the focus, even if it has a tabindex. This is only true for elements with tabindex="-2".
*/
isFocusPrevented(element: HTMLElement | JQuery): boolean;
/**
* @param $entryPoint the entry point of the current {@link Session}
* @param nativeFocusable whether to include elements that we consider to be unfocusable but would gain the focus by the browser if we did not prevent it (elements with tabindex="-2"). Default is false.
* @returns all parents that are focusable by mouse inside a focus boundary (marked by elements having the class .focus-boundary)
*/
getParentsFocusableByMouse(element: HTMLElement | JQuery, $entryPoint: JQuery, nativeFocusable?: boolean): JQuery;
/**
* @param $entryPoint the entry point of the current {@link Session}
* @param nativeFocusable whether to include elements that we consider to be unfocusable but would gain the focus by the browser if we did not prevent it (elements with tabindex="-2"). Default is false.
* @returns the given element if it is focusable by mouse, or the first parent that is focusable by mouse.
*/
closestFocusableByMouse(element: HTMLElement | JQuery, $entryPoint: JQuery, nativeFocusable?: boolean): JQuery;
/**
* @returns whether the given element has a parent which is focusable by mouse.
*/
containsParentFocusableByMouse(element: HTMLElement | JQuery, $entryPoint: JQuery): boolean;
/**
* @returns whether the given element contains content which is selectable to the user, e.g. to be copied into clipboard.
* It also returns true for disabled text-fields, because the user must be able to select and copy text from these text-fields.
*/
isSelectableText(element: HTMLElement | JQuery): boolean;
/**
* @returns true if the element or one of its parents is draggable.
*/
isDraggable(element: HTMLElement | JQuery): boolean;
/**
* @returns true if the given HTML element is the active element in its own document, false otherwise.
*/
isActiveElement(element: HTMLElement | JQuery): boolean;
/**
* Stores the currently focused element and focuses this element again in the next animation frame if the focus changed to the entry point element.
* This is useful if the current task would focus the entry point element which cannot be prevented.
*
* @param $entryPoint the entry point of the current {@link Session}
* @param options options to be passed to the {@link HTMLElement.focus} call
*/
restoreFocusLater($entryPoint: JQuery, options?: FocusOptions): void;
/**
* Sets the focus to the given target element just before the next repaint (using requestAnimationFrame).
* This allows other event handlers to be fired before the focus is actually changed.
*
* @param target the element to be focused
* @param options options to be passed to the {@link HTMLElement.focus} call
*/
focusLater(target: HTMLElement | JQuery, options?: FocusOptions): void;
};
//# sourceMappingURL=focusUtils.d.ts.map