diff --git a/.changeset/thick-ways-happen.md b/.changeset/thick-ways-happen.md new file mode 100644 index 00000000..3089feca --- /dev/null +++ b/.changeset/thick-ways-happen.md @@ -0,0 +1,5 @@ +--- +"@devup-ui/components": patch +--- + +Fix Select overflow position diff --git a/packages/components/src/components/Select/__tests__/__snapshots__/index.browser.test.tsx.snap b/packages/components/src/components/Select/__tests__/__snapshots__/index.browser.test.tsx.snap index af8b0ff9..34a4334e 100644 --- a/packages/components/src/components/Select/__tests__/__snapshots__/index.browser.test.tsx.snap +++ b/packages/components/src/components/Select/__tests__/__snapshots__/index.browser.test.tsx.snap @@ -49,7 +49,7 @@ exports[`Select > should render with overflow screen 1`] = `
{ const { - width, height, x: comboboxX, y: comboboxY, @@ -241,7 +240,7 @@ export function SelectContainer({ document.documentElement.scrollHeight const isOverflowRight = - el.offsetWidth + left + window.scrollX + width + x > + el.offsetWidth + left + window.scrollX + x > document.documentElement.scrollWidth if (isOverflowBottom) @@ -249,7 +248,7 @@ export function SelectContainer({ else el.style.top = `${comboboxY + height + 10 + y}px` if (isOverflowRight) - el.style.left = `${comboboxX - el.offsetWidth + combobox.offsetWidth + x}px` + el.style.left = `${Math.max(comboboxX - el.offsetWidth + combobox.offsetWidth, 0) + x}px` else el.style.left = `${comboboxX + x}px` }