@wordpress/components
Version:
UI components for WordPress.
23 lines (20 loc) • 482 B
JavaScript
/**
* WordPress dependencies
*/
import {
createHigherOrderComponent,
useConstrainedTabbing,
} from '@wordpress/compose';
const withConstrainedTabbing = createHigherOrderComponent(
( WrappedComponent ) =>
function ComponentWithConstrainedTabbing( props ) {
const ref = useConstrainedTabbing();
return (
<div ref={ ref } tabIndex="-1">
<WrappedComponent { ...props } />
</div>
);
},
'withConstrainedTabbing'
);
export default withConstrainedTabbing;