Skip to content

Commit

Permalink
First pass on focusable-iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
margolisj committed Sep 5, 2023
1 parent e2237b8 commit b47d32d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/components/src/focusable-iframe/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* WordPress dependencies
*/
import { useMergeRefs, useFocusableIframe } from '@wordpress/compose';
import deprecated from '@wordpress/deprecated';
/**
* Internal dependencies
*/
import type { FocusableIframeProps } from './types';

/**
* @param {Object} props
* @param {import('react').Ref<HTMLIFrameElement>} props.iframeRef
*/
export default function FocusableIframe( {
iframeRef,
...props
}: FocusableIframeProps ) {
const ref = useMergeRefs( [ iframeRef, useFocusableIframe() ] );
deprecated( 'wp.components.FocusableIframe', {
since: '5.9',
alternative: 'wp.compose.useFocusableIframe',
} );
// Disable reason: The rendered iframe is a pass-through component,
// assigning props inherited from the rendering parent. It's the
// responsibility of the parent to assign a title.
// eslint-disable-next-line jsx-a11y/iframe-has-title
return <iframe ref={ ref } { ...props } />;
}
4 changes: 4 additions & 0 deletions packages/components/src/focusable-iframe/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface FocusableIframeProps {
iframeRef: React.Ref< HTMLIFrameElement >;
props: any;
}

0 comments on commit b47d32d

Please sign in to comment.