Skip to content

fix(react-aria): scope ariaHideOutside to target document - #10595

Open
dvd233 wants to merge 1 commit into
adobe:mainfrom
dvd233:fix/aria-hide-outside-owner-document
Open

fix(react-aria): scope ariaHideOutside to target document#10595
dvd233 wants to merge 1 commit into
adobe:mainfrom
dvd233:fix/aria-hide-outside-owner-document

Conversation

@dvd233

@dvd233 dvd233 commented Sep 10, 2026

Copy link
Copy Markdown

Closes #10581

Summary

Scope ariaHideOutside's default root to the document that owns its first target instead of the module-global document. This keeps modal and popover isolation within the secondary window/document where the overlay is rendered, while preserving the existing behavior when callers provide an explicit root or render in the main document.

The implementation uses the windowObj that ariaHideOutside already derives from the target. A regression test creates a second document, verifies that content beside the target is hidden there, and verifies that the opener document's body is not hidden.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (unit regression test added; no visual state requires a Storybook update).
  • Filled out test instructions.
  • Updated documentation (not applicable; this corrects internal document scoping without changing the public API).
  • Looked at the Accessibility Practices for this feature - Aria Practices
  • I understand every change in this PR and can explain why it's there.
  • If AI-assisted, I followed our AI contribution guidance and pointed my assistant at CLAUDE.md. I reviewed and verified the final change and test.

📝 Test Instructions:

Run:

corepack yarn jest packages/react-aria/test/overlays/ariaHideOutside.test.js --runInBand

The suite should pass all 25 tests. In the new should use the target document as the default root case, verify that:

  • the sibling in the secondary document receives aria-hidden="true";
  • the target remains visible;
  • the main document's <body> remains untouched; and
  • cleanup restores the secondary document sibling.

Additional checks used locally:

corepack yarn format:check -- packages/react-aria/src/overlays/ariaHideOutside.ts packages/react-aria/test/overlays/ariaHideOutside.test.js
oxlint packages/react-aria/src/overlays/ariaHideOutside.ts packages/react-aria/test/overlays/ariaHideOutside.test.js
corepack yarn check-types

All three pass. A repo-wide Jest run passed 7,989 tests; its 16 failures are confined to existing Windows path-separator expectations in packages/dev/parcel-resolver-optimize-locales/test/LocalesResolver.test.js. The SSR run passed 59 of 60 suites, with the unrelated DatePicker SSR test timing out locally.

🧢 Your Project:

N/A


it('should use the target document as the default root', function () {
let iframe = document.createElement('iframe');
document.body.appendChild(iframe);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to clarify, the bug was that the top level root document's body was getting hidden, which hides everything below it

however, this should probably be hiding siblings of the iframe still

can you add an element alongside the iframe and assert it's hidden?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ariaHideOutside defaults to the module-global document, so modals in a second window hide the opener's <body>

2 participants