@@ -9,8 +9,8 @@ import useId from '@rc-component/util/lib/hooks/useId';
99import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect' ;
1010import * as React from 'react' ;
1111import Popup , { type MobileConfig } from './Popup' ;
12- import type { TriggerContextProps } from './context' ;
13- import TriggerContext from './context' ;
12+ import type { TriggerContextProps , UniqueContextProps } from './context' ;
13+ import TriggerContext , { UniqueContext } from './context' ;
1414import useAction from './hooks/useAction' ;
1515import useAlign from './hooks/useAlign' ;
1616import useWatch from './hooks/useWatch' ;
@@ -208,6 +208,9 @@ export function generateTrigger(
208208 } ;
209209 } , [ parentContext ] ) ;
210210
211+ // ======================== UniqueContext =========================
212+ const uniqueContext = React . useContext ( UniqueContext ) ;
213+
211214 // =========================== Popup ============================
212215 const id = useId ( ) ;
213216 const [ popupEle , setPopupEle ] = React . useState < HTMLDivElement > ( null ) ;
@@ -299,6 +302,16 @@ export function generateTrigger(
299302 lastTriggerRef . current = [ ] ;
300303
301304 const internalTriggerOpen = useEvent ( ( nextOpen : boolean ) => {
305+ // If UniqueContext exists, delegate show/hide to Provider
306+ if ( uniqueContext ) {
307+ if ( nextOpen && targetEle ) {
308+ uniqueContext . show ( targetEle ) ;
309+ } else {
310+ uniqueContext . hide ( targetEle ) ;
311+ }
312+ return ;
313+ }
314+
302315 setMergedOpen ( nextOpen ) ;
303316
304317 // Enter or Pointer will both trigger open state change
0 commit comments