File tree 1 file changed +3
-13
lines changed
1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -85,19 +85,9 @@ class TextExpander {
85
85
this . expander . dispatchEvent ( new Event ( 'text-expander-activate' ) )
86
86
87
87
const caretRect = new InputRange ( this . input , match . position ) . getBoundingClientRect ( )
88
- const nominalPosition = { top : caretRect . top + caretRect . height , left : caretRect . left }
89
- menu . style . top = `${ nominalPosition . top } px`
90
- menu . style . left = `${ nominalPosition . left } px`
91
-
92
- // Nominal position is relative to entire document, but the menu could be positioned relative to a container if
93
- // it is not `fixed` or on the top layer
94
- const actualPosition = menu . getBoundingClientRect ( )
95
-
96
- const topDelta = actualPosition . top - nominalPosition . top
97
- if ( topDelta !== 0 ) menu . style . top = `${ nominalPosition . top - topDelta } px`
98
-
99
- const leftDelta = actualPosition . left - nominalPosition . left
100
- if ( leftDelta !== 0 ) menu . style . left = `${ nominalPosition . left - leftDelta } px`
88
+ const currentPosition = menu . getBoundingClientRect ( )
89
+ const delta = { x : caretRect . x - currentPosition . x , y : caretRect . y + caretRect . height - currentPosition . y }
90
+ menu . style . transform = `translate(${ delta . x } px, ${ delta . y } px)`
101
91
102
92
this . combobox . start ( )
103
93
menu . addEventListener ( 'combobox-commit' , this . oncommit )
You can’t perform that action at this time.
0 commit comments