Skip to content

Alternate overflow options #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,13 @@ async function checkOverflow(target: HTMLElement, offsetParent: HTMLElement) {
y: target.offsetTop,
platform: platformWithCache,
rects,
elements: { floating: target },
elements: {
floating: target,
reference: offsetParent,
},
strategy: 'absolute',
} as unknown as MiddlewareState,
{
boundary: offsetParent,
rootBoundary: 'document',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As context, if I recall correctly, I was being overly explicit in this call, but it turns out these options are not always correct, and the defaults are actually what we want.

padding: getMargins(target),
},
);
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/polyfill.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ test('updates when sizes change', async ({ page }) => {
test('applies polyfill for `@position-fallback`', async ({ page }) => {
const targetSel = '#my-target-fallback';
const target = page.locator(targetSel);
await target.scrollIntoViewIfNeeded();

await expect(target).toHaveCSS('left', '0px');

Expand All @@ -124,6 +125,7 @@ test('applies polyfill for `@position-fallback`', async ({ page }) => {
});

await expect(target).toHaveCSS('width', '100px');
await expect(target).toHaveCSS('height', '100px');
});

test('applies manual polyfill', async ({ page }) => {
Expand Down
Loading