UNPKG

@gechiui/components

Version:
34 lines (30 loc) 825 B
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@gechiui/element"; /** * GeChiUI dependencies */ import { useRef, useLayoutEffect } from '@gechiui/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