From 5203d40a245bba3be7051b669aa0de60514e647e Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Thu, 16 Apr 2020 00:40:22 +0200 Subject: [PATCH] Restore original focus after hitting publish button --- app/src/components/Sidebar/Publish/Publish.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/components/Sidebar/Publish/Publish.tsx b/app/src/components/Sidebar/Publish/Publish.tsx index fc785d8..f1907e5 100644 --- a/app/src/components/Sidebar/Publish/Publish.tsx +++ b/app/src/components/Sidebar/Publish/Publish.tsx @@ -157,9 +157,23 @@ const PublishButton = (props: { publish: () => void }) => { [props.publish] ) + const onFocus = useCallback( + (e: React.FocusEvent) => { + (e.relatedTarget as HTMLElement|null)?.focus() + }, + [] + ) + return useMemo( () => ( - ),