timc1 / kbar

fast, portable, and extensible cmd+k interface for your site
https://kbar.vercel.app
MIT License
4.84k stars 185 forks source link

Closing kbar triggers scroll to bottom of page #278

Closed terabyte128 closed 1 year ago

terabyte128 commented 1 year ago

I'm having a super weird issue with kbar that I'm out of ideas for how to troubleshoot. On this website, on Safari for macOS 16.2, closing the kbar either via pressing Escape or clicking outside of it, scrolls the window to the bottom of the page.

I haven't been able to reproduce this behavior with any other website or any other browser. I've attempted to eliminate as much other CSS and JS as possible from the page to narrow down the issue, and I haven't been able to get anywhere.

I'm wondering if you might have any ideas for what could be causing this behavior?

timc1 commented 1 year ago

Hey @terabyte128! It looks like you may be using disableDocumentLock – if you toggle open kbar you'll notice you can still scroll the background content. I think disabling that will fix your issue.

We actually had this problem when we first released the lib: https://github.com/timc1/kbar/blob/main/src/InternalEvents.tsx#L248

terabyte128 commented 1 year ago

Unfortunately, removing disableDocumentLock didn't appear to fix the issue. I've updated the website to illustrate the behavior with that removed.