File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
packages/kit-headless/src/components/popover Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,24 @@ export const FloatingPopover = component$((props: PropsOf<'div'>) => {
61
61
} ) . then ( async ( resolvedData ) => {
62
62
const { x, y } = resolvedData ;
63
63
64
- Object . assign ( popover . style , {
65
- left : `${ x } px` ,
66
- top : `${ y } px` ,
67
- transform : context . transform ,
68
- } ) ;
64
+ const isRTL = document . documentElement . dir === 'rtl' ;
65
+
66
+ if ( isRTL ) {
67
+ const documentWidth = document . body . getBoundingClientRect ( ) . width ;
68
+ const popoverWidth = popover . getBoundingClientRect ( ) . width ;
69
+
70
+ Object . assign ( popover . style , {
71
+ right : `${ documentWidth - x - popoverWidth } px` ,
72
+ top : `${ y } px` ,
73
+ transform : context . transform ,
74
+ } ) ;
75
+ } else {
76
+ Object . assign ( popover . style , {
77
+ left : `${ x } px` ,
78
+ top : `${ y } px` ,
79
+ transform : context . transform ,
80
+ } ) ;
81
+ }
69
82
70
83
if ( resolvedData . middlewareData . arrow && context . arrowRef ?. value ) {
71
84
const { x, y } = resolvedData . middlewareData . arrow ;
You can’t perform that action at this time.
0 commit comments