Skip to content

Commit

Permalink
FocusableIframe: refactor to TypeScript (#53979)
Browse files Browse the repository at this point in the history
* First pass on focusable-iframe

* Rm old file and fancy props type.

* Updates changelog

* Removes old JSDocs
  • Loading branch information
margolisj committed Sep 5, 2023
1 parent e2237b8 commit b5a6f0b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@

- `Composite`: Convert to TypeScript ([#54028](https://github.com/WordPress/gutenberg/pull/54028)).
- `BorderControl`: Refactor unit tests to use `userEvent` ([#54155](https://github.com/WordPress/gutenberg/pull/54155))
- `FocusableIframe`: Convert to TypeScript ([#53979](https://github.com/WordPress/gutenberg/pull/53979)).

## 25.7.0 (2023-08-31)

Expand Down
Expand Up @@ -3,12 +3,15 @@
*/
import { useMergeRefs, useFocusableIframe } from '@wordpress/compose';
import deprecated from '@wordpress/deprecated';

/**
* @param {Object} props
* @param {import('react').Ref<HTMLIFrameElement>} props.iframeRef
* Internal dependencies
*/
export default function FocusableIframe( { iframeRef, ...props } ) {
import type { FocusableIframeProps } from './types';

export default function FocusableIframe( {
iframeRef,
...props
}: FocusableIframeProps ) {
const ref = useMergeRefs( [ iframeRef, useFocusableIframe() ] );
deprecated( 'wp.components.FocusableIframe', {
since: '5.9',
Expand Down
9 changes: 9 additions & 0 deletions packages/components/src/focusable-iframe/types.ts
@@ -0,0 +1,9 @@
/**
* External dependencies
*/
import type { ComponentPropsWithoutRef } from 'react';

export interface FocusableIframeProps
extends ComponentPropsWithoutRef< 'iframe' > {
iframeRef: React.Ref< HTMLIFrameElement >;
}

1 comment on commit b5a6f0b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in b5a6f0b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6086215194
📝 Reported issues:

Please sign in to comment.