@create-figma-plugin/ui
Version:
Production-grade Preact components that replicate the Figma UI design
12 lines • 531 B
JavaScript
import { useEffect } from 'preact/hooks';
import { createFocusTrapKeyDownHandler } from '../../utilities/private/create-focus-trap-key-down-handler.js';
export function useFocusTrap(rootElement) {
useEffect(function () {
const handleKeyDown = createFocusTrapKeyDownHandler(rootElement);
window.addEventListener('keydown', handleKeyDown);
return function () {
window.removeEventListener('keydown', handleKeyDown);
};
}, [rootElement]);
}
//# sourceMappingURL=use-focus-trap.js.map