A Popover rendered inside a Select popover inherits the Select PopoverContext
Provide a general summary of the issue here
A standalone Popover rendered inside a Select's popover content inherits the Select's PopoverContext: its render props report trigger="Select".
Expected Behavior?
A Popover with its own triggerRef and isOpen gets no context from an enclosing overlay, and reports trigger as null like the same Popover rendered outside any overlay.
Current Behavior
outside any overlay: nested trigger=null
inside the Select popover: nested trigger=SelectPossible Solution
RAC's Popover resets only the contexts its owner passes as clearContexts (react-aria-components/dist/private/Popover.mjs:143-149). Select's CLEAR_CONTEXTS (Select.mjs:84-88) is LabelContext, ButtonContext and TextContext (imports at :1,6,10), so PopoverContext reaches everything inside the Select's popover. Clearing PopoverContext for a popover's content would cover it.
Context
Found while building a design system on React Aria Components. Observed in headless Chromium (Playwright 1.63, real key and mouse events) with react-aria-components 1.21.1 / react-aria 3.52.1 / react-stately 3.50.0 and no other code.
️ Steps to Reproduce
import { useRef } from "react";
import { Button, ListBox, ListBoxItem, Popover, Select, SelectValue } from "react-aria-components";
function Probe() {
const ref = useRef(null);
return (
<>
<button ref={ref}>anchor</button>
<Popover triggerRef={ref} isOpen isNonModal>
{({ trigger }) => "nested trigger=" + String(trigger)}
</Popover>
</>
);
}
export function Repro() {
return (
<>
<Select aria-label="s">
<Button><SelectValue /></Button>
<Popover>
<ListBox><ListBoxItem id="a">a</ListBoxItem></ListBox>
<Probe />
</Popover>
</Select>
<Probe />
</>
);
}Open the Select and read both probes' text.
Version
react-aria-components 1.21.1, react-aria 3.52.1, react-stately 3.50.0, React 19.3.0
What browsers are you seeing the problem on?
Chrome
What operating system are you using?
macOS
Your Company/Team
No response
Tracking Issue
No response
Source: adobe/react-spectrum