Skip to content

Commit

Permalink
fix: allows menu to position correctly in RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
geotrev committed Feb 29, 2024
1 parent 1f19180 commit ce407db
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 1 deletion.
98 changes: 98 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion packages/dropdowns.next/src/elements/menu/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ export const toFloatingPlacement = (
if (isRtl) {
/* Map Floating-UI to RTL placements */
const placementMapRtl: Record<string, FloatingPlacement> = {
'top-start': 'top-end',
'top-end': 'top-start',
left: 'right',
'left-start': 'right-start',
'left-end': 'right-end',
right: 'left',
'right-start': 'left-start',
'right-end': 'left-end'
'right-end': 'left-end',
'bottom-start': 'bottom-end',
'bottom-end': 'bottom-start'
};

retVal = placementMapRtl[retVal] || retVal;
Expand Down

0 comments on commit ce407db

Please sign in to comment.