MCPcopy Create free account
hub / github.com/adobe/react-spectrum / dispatchVirtualFocus

Function dispatchVirtualFocus

packages/react-aria/src/focus/virtualFocus.ts:21–24  ·  view source on GitHub ↗
(to: Element, from: Element | null)

Source from the content-addressed store, hash-verified

19}
20
21export function dispatchVirtualFocus(to: Element, from: Element | null): void {
22 to.dispatchEvent(new FocusEvent('focus', {relatedTarget: from}));
23 to.dispatchEvent(new FocusEvent('focusin', {bubbles: true, relatedTarget: from}));
24}
25
26export function getVirtuallyFocusedElement(document: Document): Element | null {
27 let activeElement = getActiveElement(document);

Callers 5

useComboBoxFunction · 0.90
useSelectableCollectionFunction · 0.90
onChangeFunction · 0.90
onFocusFunction · 0.90
moveVirtualFocusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected