Skip to content

Commit 83e2abc

Browse files
committed
deslop: trim comments and changeset to one line
1 parent 662a938 commit 83e2abc

3 files changed

Lines changed: 2 additions & 6 deletions

File tree

.changeset/descendants-iframe-owner-document.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@leafygreen-ui/descendants': patch
33
---
44

5-
[UXE-495](https://jira.mongodb.org/browse/UXE-495): Fix descendant registration failing inside an iframe. Descendant components (e.g. `Tabs`) rendered in an iframe would all appear selected because the containment check compared against the top-level `document` instead of the element's own document. The check now uses `ref.current.ownerDocument`, so registration works across document boundaries.
5+
[UXE-495](https://jira.mongodb.org/browse/UXE-495): Fix Tabs (and other descendant components) all appearing selected when rendered inside an iframe.

packages/descendants/src/Descendants/Descendants.spec.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ describe('packages/descendants', () => {
174174
});
175175

176176
test('registers descendants rendered inside an iframe', () => {
177-
// Elements inside an iframe belong to a different document than the
178-
// top-level `document`, so registration must use the element's
179-
// ownerDocument for the containment check. (UXE-495)
180177
const iframe = document.createElement('iframe');
181178
document.body.appendChild(iframe);
182179
const iframeDocument = iframe.contentDocument!;

packages/descendants/src/Descendants/useDescendant.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ export const useDescendant = <T extends HTMLElement>(
5252
// On render, register the element as a descendant
5353
useIsomorphicLayoutEffect(() => {
5454
const _id = id.current;
55-
// Use the element's owning document so containment checks work inside an
56-
// iframe, where the global `document` differs from the element's document.
55+
// Use ownerDocument so containment checks work when the element is in an iframe.
5756
const refExists =
5857
ref.current?.ownerDocument?.contains(ref.current) ?? false;
5958

0 commit comments

Comments
 (0)