UNPKG

@wordpress/components

Version:
34 lines (30 loc) 831 B
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * WordPress dependencies */ import { useRef, useLayoutEffect } from '@wordpress/element'; /** * Internal dependencies */ import Button from '../button'; export default function FinishButton(props) { const ref = useRef(); // Focus the button on mount if nothing else is focused. This prevents a // focus loss when the 'Next' button is swapped out. useLayoutEffect(() => { const { ownerDocument } = ref.current; const { activeElement, body } = ownerDocument; if (!activeElement || activeElement === body) { ref.current.focus(); } }, []); return createElement(Button, _extends({}, props, { ref: ref })); } //# sourceMappingURL=finish-button.js.map