thuliteio/doks

Docsearch safari bug: goes to end of page if modal is closed

jollydodo opened this issue · 1 comments

Description

if you open the docsearch modal and close it by pressing escape or outside the model, the browser will scroll to the end of the page very quickly. This is weird behaviour caused by the Algolia modal (only in Safari up till the current version). Multiple GitHub issues have been created about this since 2022, but there has been no fix by Algolia.

algolia/docsearch#1260

Steps to reproduce

See Above

Expected result

Nothing

Actual result

Scroll down

Environment

My own private environment, but you can reproduce it on getdoks.org.

Fix

It's kind of a buggy fix, but it works and everybody seems to use it. Even the creators of Bootstrap. https://getbootstrap.com/docs/5.3/getting-started/introduction/ (check source)

The solution is to simply add this to the end of your footer:

<div style="position: fixed; z-index: -1;">
   <input type="text">
</div>

Thanks!