How to use the @wordpress/dom.focus function in @wordpress/dom

To help you get started, we’ve selected a few @wordpress/dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / wordpress__dom / wordpress__dom-tests.ts View on Github external
// $ExpectType Node || ChildNode
const node = element.previousSibling!;

// $ExpectType Range
const range = document.createRange();

// --------------

// $ExpectType DOMRect | undefined
dom.computeCaretRect();

// $ExpectType boolean
dom.documentHasSelection();

// $ExpectType Element[]
dom.focus.focusable.find(element);

// $ExpectType Element[]
dom.focus.tabbable.find(element);

// $ExpectType boolean
dom.focus.tabbable.isTabbableIndex(element);

// $ExpectType Element | null
dom.getOffsetParent(node);

// $ExpectType DOMRect
dom.getRectangleFromRange(range);

// $ExpectType Element | undefined
dom.getScrollContainer(element);
github DefinitelyTyped / DefinitelyTyped / types / wordpress__dom / wordpress__dom-tests.ts View on Github external
// $ExpectType Range
const range = document.createRange();

// --------------

// $ExpectType DOMRect | undefined
dom.computeCaretRect();

// $ExpectType boolean
dom.documentHasSelection();

// $ExpectType Element[]
dom.focus.focusable.find(element);

// $ExpectType Element[]
dom.focus.tabbable.find(element);

// $ExpectType boolean
dom.focus.tabbable.isTabbableIndex(element);

// $ExpectType Element | null
dom.getOffsetParent(node);

// $ExpectType DOMRect
dom.getRectangleFromRange(range);

// $ExpectType Element | undefined
dom.getScrollContainer(element);

// $ExpectType void
dom.insertAfter(node, node);