Skip to content

Commit 0c545b0

Browse files
committed
fix(react-aria-components): set id on Popover, remove from DialogContext, update DialogTester
1 parent aa08cd1 commit 0c545b0

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/@react-aria/test-utils/src/dialog.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ export class DialogTester {
8282
if (!dialogId || document.getElementById(dialogId) == null) {
8383
throw new Error(`Dialog with id of ${dialogId} not found in document.`);
8484
} else {
85-
this._dialog = document.getElementById(dialogId)!;
85+
let el = document.getElementById(dialogId)!;
86+
let nestedDialog = el.querySelector('[role=dialog], [role=alertdialog]');
87+
this._dialog = nestedDialog as HTMLElement || el;
8688
return true;
8789
}
8890
});

packages/react-aria-components/src/Dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function DialogTrigger(props: DialogTriggerProps): JSX.Element {
7878
values={[
7979
[OverlayTriggerStateContext, state],
8080
[RootMenuTriggerStateContext, state],
81-
[DialogContext, overlayProps],
81+
[DialogContext, {...overlayProps, id: undefined}],
8282
[PopoverContext, {
8383
trigger: 'DialogTrigger',
8484
triggerRef: buttonRef,

packages/react-aria-components/src/Popover.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ function PopoverInner({state, isExiting, UNSTABLE_portalContainer, clearContexts
225225
<dom.div
226226
{...mergeProps(filterDOMProps(props, {global: true}), popoverProps)}
227227
{...renderProps}
228-
id={isDialog ? props.id : undefined}
229228
role={isDialog ? 'dialog' : undefined}
230229
tabIndex={isDialog ? -1 : undefined}
231230
aria-label={props['aria-label']}

0 commit comments

Comments
 (0)