File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
packages/autocomplete-js/src Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,14 @@ export function getPanelPlacementStyle({
1515 environment,
1616} : GetPanelPlacementStyleParams ) {
1717 const containerRect = container . getBoundingClientRect ( ) ;
18- const top =
19- environment . document . body . scrollTop +
20- containerRect . top +
21- containerRect . height ;
18+ // Some browsers have specificities to retrieve the document scroll position.
19+ // See https://stackoverflow.com/a/28633515/9940315
20+ const scrollTop =
21+ ( environment . pageYOffset as number ) ||
22+ environment . document . documentElement . scrollTop ||
23+ environment . document . body . scrollTop ||
24+ 0 ;
25+ const top = scrollTop + containerRect . top + containerRect . height ;
2226
2327 switch ( panelPlacement ) {
2428 case 'start' : {
You can’t perform that action at this time.
0 commit comments