Skip to content

Commit

Permalink
Use absolute position
Browse files Browse the repository at this point in the history
  • Loading branch information
jperals committed Jan 17, 2025
1 parent 291cc98 commit ef671e1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/internal/components/dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ const Dropdown = ({

// Position normal overflow dropdowns with fixed positioning relative to viewport
if (expandToViewport && !interior) {
target.style.position = 'fixed';
target.style.position = 'absolute';
if (position.dropBlockStart) {
target.style.insetBlockEnd = `calc(100% - ${triggerBox.top}px)`;
target.style.insetBlockEnd = `calc(100% - ${document.documentElement.scrollTop + triggerBox.top}px)`;

Check warning on line 238 in src/internal/components/dropdown/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/internal/components/dropdown/index.tsx#L238

Added line #L238 was not covered by tests
} else {
target.style.insetBlockStart = `${triggerBox.bottom}px`;
target.style.insetBlockStart = `${document.documentElement.scrollTop + triggerBox.bottom}px`;
}
if (position.dropInlineStart) {
target.style.insetInlineStart = `calc(${triggerBox.right}px - ${position.inlineSize})`;
Expand Down Expand Up @@ -395,9 +395,9 @@ const Dropdown = ({
const target = dropdownRef.current;
if (fixedPosition.current) {
if (fixedPosition.current.dropBlockStart) {
dropdownRef.current.style.insetBlockEnd = `calc(100% - ${triggerRect.insetBlockStart}px)`;
dropdownRef.current.style.insetBlockEnd = `calc(100% - ${document.documentElement.scrollTop + triggerRect.insetBlockStart}px)`;

Check warning on line 398 in src/internal/components/dropdown/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/internal/components/dropdown/index.tsx#L398

Added line #L398 was not covered by tests
} else {
target.style.insetBlockStart = `${triggerRect.insetBlockEnd}px`;
target.style.insetBlockStart = `${document.documentElement.scrollTop + triggerRect.insetBlockEnd}px`;
}
if (fixedPosition.current.dropInlineStart) {
target.style.insetInlineStart = `calc(${triggerRect.insetInlineEnd}px - ${fixedPosition.current.inlineSize})`;
Expand Down

0 comments on commit ef671e1

Please sign in to comment.