Skip to content

Commit 70e88a6

Browse files
authored
Merge pull request #47987 from daledah/fix/46532
fix: dropdown menu misalign on search page
2 parents 6b9ce29 + 310affb commit 70e88a6

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

src/components/ButtonWithDropdownMenu/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function ButtonWithDropdownMenu<IValueType>({
3939
enterKeyEventListenerPriority = 0,
4040
wrapperStyle,
4141
useKeyboardShortcuts = false,
42+
shouldUseStyleUtilityForAnchorPosition = false,
4243
defaultSelectedIndex = 0,
4344
shouldShowSelectedItemCheck = false,
4445
}: ButtonWithDropdownMenuProps<IValueType>) {
@@ -175,7 +176,7 @@ function ButtonWithDropdownMenu<IValueType>({
175176
}}
176177
onModalShow={onOptionsMenuShow}
177178
onItemSelected={() => setIsMenuVisible(false)}
178-
anchorPosition={popoverAnchorPosition}
179+
anchorPosition={shouldUseStyleUtilityForAnchorPosition ? styles.popoverButtonDropdownMenuOffset(windowWidth) : popoverAnchorPosition}
179180
shouldShowSelectedItemCheck={shouldShowSelectedItemCheck}
180181
anchorRef={nullCheckRef(dropdownAnchor)}
181182
withoutOverlay

src/components/ButtonWithDropdownMenu/types.ts

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ type ButtonWithDropdownMenuProps<TValueType> = {
9696
/** Whether to use keyboard shortcuts for confirmation or not */
9797
useKeyboardShortcuts?: boolean;
9898

99+
/** Determines if a style utility function should be used for calculating the PopoverMenu anchor position. */
100+
shouldUseStyleUtilityForAnchorPosition?: boolean;
101+
99102
/** Decides which index in menuItems should be selected */
100103
defaultSelectedIndex?: number;
101104

src/components/Search/SearchPageHeader.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
316316
customText={translate('workspace.common.selected', {selectedNumber: selectedTransactionsKeys.length})}
317317
options={headerButtonsOptions}
318318
isSplitButton={false}
319+
shouldUseStyleUtilityForAnchorPosition
319320
/>
320321
) : (
321322
<Button

src/styles/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3646,6 +3646,12 @@ const styles = (theme: ThemeColors) =>
36463646
horizontal: windowWidth - 355,
36473647
} satisfies AnchorPosition),
36483648

3649+
popoverButtonDropdownMenuOffset: (windowWidth: number) =>
3650+
({
3651+
...getPopOverVerticalOffset(70),
3652+
horizontal: windowWidth - 20,
3653+
} satisfies AnchorPosition),
3654+
36493655
iPhoneXSafeArea: {
36503656
backgroundColor: theme.inverse,
36513657
flex: 1,

0 commit comments

Comments
 (0)