afcapel / stimulus-autocomplete

Stimulus autocomplete component
MIT License
482 stars 63 forks source link

Fix weird scrolling behaviour #91

Closed afcapel closed 2 years ago

afcapel commented 2 years ago

Fixes the behaviour described in https://github.com/afcapel/stimulus-autocomplete/pull/58#issuecomment-785687882

Using the block: "nearest" option of scrollIntoView fixes the scrolling to the bottom of the page.

BEFORE:

https://user-images.githubusercontent.com/150107/147972683-87a87aa4-8e77-4401-b843-5ca6c6888945.mov

AFTER:

https://user-images.githubusercontent.com/150107/147972696-b8ed9cce-fc94-4457-bd4f-5c8a020c9d54.mov

netlify[bot] commented 2 years ago

✔️ Deploy Preview for stimulus-autocomplete ready!

🔨 Explore the source changes: 9b1b327d4272a4e4145a1cd095331ac74e4d7f27

🔍 Inspect the deploy log: https://app.netlify.com/sites/stimulus-autocomplete/deploys/61d353010bb36800099c20e8

😎 Browse the preview: https://deploy-preview-91--stimulus-autocomplete.netlify.app