components/tooltip/shared/sharedFAQ.en-US.md
<Antd component="Alert" title="The following FAQ applies to Tooltip, Popconfirm, Popover components." type="warning" banner="true"></Antd>
findDOMNode is deprecated sometimes appear in strict mode?This is due to the implementation of @rc-component/trigger. @rc-component/trigger forces children to accept ref, otherwise it will fall back to findDOMNode, so children need to be native html tags. If not, you need to use React.forwardRef transparently passes ref to native html tags.
findDOMNode is deprecated reproduce: https://codesandbox.io/p/sandbox/finddomnode-c5hy96forwardRef to fix: https://codesandbox.io/p/sandbox/no-finddomnode-warning-forked-gdxczsSimilar issues: #15909, #12812.
Please ensure that the child node to accept onMouseEnter, onMouseLeave, onPointerEnter, onPointerLeave, onFocus, and onClick events, If you create your own component and do not explicitly add these mouse and pointer events as props, the tooltip will never appear. See Example.
It will follow placement config when screen has enough space. And flip when space is not enough (Such as top to bottom or topLeft to bottomLeft). Single direction such as top bottom left right will auto shift on the view:
When placement is set to edge align such as topLeft bottomRight, it will only do flip but not do shift.
By default, Tooltip and similar components trigger on hover rather than focus, so they will not respond to keyboard focus events. If you want the component to support keyboard accessibility, you can enable it in the following ways:
trigger property to include focus, for example trigger="focus" or trigger={['hover', 'focus']}.ConfigProvider to set global configuration, so all relevant components across your application support keyboard focus trigger by default.import { ConfigProvider, Tooltip, Button } from 'antd';
// Single component
<Tooltip trigger={['hover', 'focus']} title="Title">
<Button>Button</Button>
</Tooltip>
// Global configuration
<ConfigProvider
tooltip={{ trigger: ['hover', 'focus'] }}
popover={{ trigger: ['hover', 'focus'] }}
popconfirm={{ trigger: ['hover', 'focus'] }}
>
<App />
</ConfigProvider>