From 129f65f1f26bac46744556fc4ec3bd244e02a405 Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Tue, 2 Jul 2024 09:47:06 -0700 Subject: [PATCH 1/2] call onFocus/onBlur --- .../react-resizable-panels/src/PanelResizeHandle.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react-resizable-panels/src/PanelResizeHandle.ts b/packages/react-resizable-panels/src/PanelResizeHandle.ts index 65c8ee371..d0444558d 100644 --- a/packages/react-resizable-panels/src/PanelResizeHandle.ts +++ b/packages/react-resizable-panels/src/PanelResizeHandle.ts @@ -208,8 +208,14 @@ export function PanelResizeHandle({ children, className: classNameFromProps, id: idFromProps, - onBlur: () => setIsFocused(false), - onFocus: () => setIsFocused(true), + onBlur: (e: React.FocusEvent) => { + setIsFocused(false); + rest?.onBlur?.(e); + }, + onFocus: () => (e: React.FocusEvent) => { + setIsFocused(true); + rest?.onFocus?.(e); + }, ref: elementRef, role: "separator", style: { From 441cf36c0ab84a3a4d303802417e4297cc056900 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 2 Jul 2024 12:54:59 -0700 Subject: [PATCH 2/2] Nits --- packages/react-resizable-panels/src/PanelResizeHandle.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-resizable-panels/src/PanelResizeHandle.ts b/packages/react-resizable-panels/src/PanelResizeHandle.ts index d0444558d..59ca64cc0 100644 --- a/packages/react-resizable-panels/src/PanelResizeHandle.ts +++ b/packages/react-resizable-panels/src/PanelResizeHandle.ts @@ -24,6 +24,7 @@ import { } from "./PanelResizeHandleRegistry"; import { assert } from "./utils/assert"; import useIsomorphicLayoutEffect from "./hooks/useIsomorphicEffect"; +import { FocusEvent } from "react"; export type PanelResizeHandleOnDragging = (isDragging: boolean) => void; export type ResizeHandlerState = "drag" | "hover" | "inactive"; @@ -208,13 +209,13 @@ export function PanelResizeHandle({ children, className: classNameFromProps, id: idFromProps, - onBlur: (e: React.FocusEvent) => { + onBlur: (event: FocusEvent) => { setIsFocused(false); - rest?.onBlur?.(e); + rest?.onBlur?.(event); }, - onFocus: () => (e: React.FocusEvent) => { + onFocus: () => (event: FocusEvent) => { setIsFocused(true); - rest?.onFocus?.(e); + rest?.onFocus?.(event); }, ref: elementRef, role: "separator",