Skip to main content

useFocusFromOpened

function useFocusFromOpened(element, isOpen): void;

Use this hook to set the focus point on an element when something becomes opened, e.g. set focus on a panel container or menu container when it becomes visible so that the next time the user hits on the tab key the element that becomes focused on is potentially a tabbable element inside the container element.

Parameters

ParameterTypeDescription
elementnull | HTMLElementelement which focus point should start from
isOpenbooleanwhen isOpen is true the element will get the focus point

Returns

void