Skip to content

Commit

Permalink
Shorten to just FocusEvent instead of ReactFocusEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Nov 27, 2023
1 parent 2562a45 commit f81724b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions packages/components/src/form-token-field/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
* External dependencies
*/
import classnames from 'classnames';
import type {
KeyboardEvent,
MouseEvent,
TouchEvent,
FocusEvent as ReactFocusEvent,
} from 'react';
import type { KeyboardEvent, MouseEvent, TouchEvent, FocusEvent } from 'react';

/**
* WordPress dependencies
Expand Down Expand Up @@ -148,7 +143,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
return input.current === input.current?.ownerDocument.activeElement;
}

function onFocusHandler( event: ReactFocusEvent ) {
function onFocusHandler( event: FocusEvent ) {
// If focus is on the input or on the container, set the isActive state to true.
if ( hasFocus() || event.target === tokensAndInput.current ) {
setIsActive( true );
Expand All @@ -167,7 +162,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
}
}

function onBlur( event: ReactFocusEvent ) {
function onBlur( event: FocusEvent ) {
if (
inputHasValidValue() &&
__experimentalValidateInput( incompleteTokenValue )
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/form-token-field/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
ComponentPropsWithRef,
MouseEventHandler,
ReactNode,
FocusEvent as ReactFocusEvent,
FocusEvent,
} from 'react';

type Messages = {
Expand Down Expand Up @@ -106,7 +106,7 @@ export interface FormTokenFieldProps
* Function to call when the TokenField has been focused on. The event is passed to the callback. Useful for analytics.
*
*/
onFocus?: ( event: ReactFocusEvent ) => void;
onFocus?: ( event: FocusEvent ) => void;
/**
* When true, renders tokens as without a background.
*/
Expand Down

0 comments on commit f81724b

Please sign in to comment.