Skip to content

Commit

Permalink
Use scrollLeft also in RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
jperals committed Jan 22, 2025
1 parent a51c015 commit a5a7d9c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/internal/components/dropdown/dropdown-position.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { getIsRtl } from '@cloudscape-design/component-toolkit/internal';

import { DropdownPosition } from './dropdown-fit-handler';

export interface LogicalDOMRect {
Expand All @@ -28,11 +26,7 @@ export function applyFixedDropdownPosition({
const useAbsolutePositioning = isMobile;

const verticalScrollOffset = useAbsolutePositioning ? document.documentElement.scrollTop : 0;
const horizontalScrollOffset = useAbsolutePositioning
? getIsRtl(document.body)
? window.innerWidth - document.documentElement.scrollLeft
: document.documentElement.scrollLeft
: 0;
const horizontalScrollOffset = useAbsolutePositioning ? document.documentElement.scrollLeft : 0;

dropdownElement.style.position = useAbsolutePositioning ? 'absolute' : 'fixed';

Expand Down

0 comments on commit a5a7d9c

Please sign in to comment.