@atlaskit/popup
Version:
A popup displays brief content in an overlay.
15 lines (13 loc) • 662 B
JavaScript
/* eslint-disable @repo/internal/react/require-jsdoc */
import { createContext } from 'react';
/**
* Provides the trigger element as a stable `MutableRefObject<HTMLElement | null>`
* for the top-layer path. Unlike `TriggerRefContext` (which provides
* `HTMLElement | null` as React state and causes a re-render when the trigger
* mounts), this context provides a ref object whose identity is stable across
* renders — allowing `useAnchoredPopover` to receive a stable anchor ref without
* needing to create a new ref wrapper on every `triggerRef` state change.
*/
export const TriggerRefObjectContext = /*#__PURE__*/createContext({
current: null
});