You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the search field has fixed positioning on the page and you scroll while the autocomplete box is open the box doesn't follow scroll. The box scrolls out of view.
Related code is here:
The problem is that autocomplete uses absolute positioning. To fix this, I suggest to have a configuration to allow it to use fixed positioning instead.
In my project, I was able to work around this issue by doing the following:
constfixPosition=()=>{constrect=document.querySelector('.search-field').getBoundingClientRect();// Set css variable to be below the search box in case the search box moved when the window was resizedsetCSSVar('--position-autocomplete-panel-top',`${rect.bottom}px`);};document.querySelector('.aa-Input').addEventListener('focus',fixPosition);document.querySelector('.aa-Input').addEventListener('blur',fixPosition);window.addEventListener('resize',fixPosition);
Description
When the search field has fixed positioning on the page and you scroll while the autocomplete box is open the box doesn't follow scroll. The box scrolls out of view.
Related code is here:
autocomplete/packages/autocomplete-js/src/getPanelPlacementStyle.ts
Line 25 in 5fd58f6
The problem is that autocomplete uses absolute positioning. To fix this, I suggest to have a configuration to allow it to use fixed positioning instead.
In my project, I was able to work around this issue by doing the following:
Reproduction
My Sandbox: https://codesandbox.io/s/youthful-microservice-6km8p4?file=/style.css:843-880
Steps
Expected behavior
It should be possible to make fixed positioning work without a CSS hack using !important.
Environment
The text was updated successfully, but these errors were encountered: