+ >,
+ baseState,
+ );
+
+ screen.getByTestId('textarea').focus();
+
+ userEvent.hover(screen.getByText('This is a link'));
+ await waitFor(() => {
+ expect(screen.queryByText('This is a link tooltip')).toBeVisible();
+ });
+
+ expect(screen.getByTestId('textarea')).toHaveFocus();
+
+ act(() => {
+ userEvent.unhover(screen.getByText('This is a link'));
+ });
+ await waitFor(() => {
+ expect(screen.queryByText('This is a link tooltip')).not.toBeInTheDocument();
+ });
+
+ expect(screen.getByTestId('textarea')).toHaveFocus();
+ });
+
+ test('should not take focus when hovered without a tooltip', async () => {
+ renderWithContext(
+ <>
+
+ >,
+ baseState,
+ );
+
+ screen.getByTestId('textarea').focus();
+
+ userEvent.hover(screen.getByText('This is a link'));
+ await waitFor(() => {
+ expect(screen.queryByText('This is a link tooltip')).not.toBeInTheDocument();
+ });
+
+ expect(screen.getByTestId('textarea')).toHaveFocus();
+
+ act(() => {
+ userEvent.unhover(screen.getByText('This is a link'));
+ });
+ await waitFor(() => {
+ expect(screen.queryByText('This is a link tooltip')).not.toBeInTheDocument();
+ });
+
+ expect(screen.getByTestId('textarea')).toHaveFocus();
+ });
+});
diff --git a/webapp/channels/src/components/plugin_link_tooltip/index.tsx b/webapp/channels/src/components/plugin_link_tooltip/index.tsx
index af18869dbb..e33271aada 100644
--- a/webapp/channels/src/components/plugin_link_tooltip/index.tsx
+++ b/webapp/channels/src/components/plugin_link_tooltip/index.tsx
@@ -13,11 +13,10 @@ import {
inline,
useTransitionStyles,
FloatingOverlay,
- FloatingFocusManager,
useFocus,
} from '@floating-ui/react';
import React, {useState} from 'react';
-import type {AnchorHTMLAttributes, ReactElement} from 'react';
+import type {AnchorHTMLAttributes, ReactNode} from 'react';
import Pluggable from 'plugins/pluggable';
import {RootHtmlPortalId, OverlaysTimings, OverlayTransitionStyles} from 'utils/constants';
@@ -26,7 +25,7 @@ import './plugin_link_tooltip.scss';
interface Props {
nodeAttributes: AnchorHTMLAttributes
;
- children: ReactElement;
+ children: ReactNode;
}
/**
@@ -74,19 +73,17 @@ export default function PluginLinkTooltip(props: Props) {
{isMounted && (
-
-
-
+
)}