From 8c3d474366d7fd8a39bc481a4111825e9c31885b Mon Sep 17 00:00:00 2001 From: Echo Date: Thu, 3 Sep 2026 11:19:39 +0000 Subject: [PATCH] Use new PolymorphicProps to silence error around missing ref (#40371) --- .../components/navigation_focus_target/index.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/javascript/mastodon/components/navigation_focus_target/index.tsx b/app/javascript/mastodon/components/navigation_focus_target/index.tsx index 56a5070fae8..c23dff79c5b 100644 --- a/app/javascript/mastodon/components/navigation_focus_target/index.tsx +++ b/app/javascript/mastodon/components/navigation_focus_target/index.tsx @@ -8,7 +8,7 @@ import { import { useLocation } from 'react-router-dom'; -import { polymorphicForwardRef } from '@/types/polymorphic'; +import type { PolymorphicProps } from '@/types/polymorphic'; import type { MastodonLocation } from '../router'; @@ -129,10 +129,13 @@ interface FocusTargetElementProps extends React.ComponentPropsWithoutRef<'h1'> { focusTargetName?: NamedFocusTarget; } -export const NavigationFocusTarget = polymorphicForwardRef< - 'h1', - FocusTargetElementProps ->(({ as: Component = 'h1', focusTargetName, children, ...otherProps }) => { +export const NavigationFocusTarget = ({ + as: asComp, + focusTargetName, + children, + ...otherProps +}: PolymorphicProps) => { + const Component = asComp ?? 'h1'; const focusOnNavigation = useFocusOnNavigation(focusTargetName); return ( @@ -140,4 +143,4 @@ export const NavigationFocusTarget = polymorphicForwardRef< {children} ); -}); +};