-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page scroll to the bottom of page when closing the modal on Safari #1260
Comments
Hey, are you able to reproduce on our documentation? docsearch.algolia.com (Sorry I'm not on a computer rn) |
No, I was not, but it looks like at least one other project had the same issue: I'm instantiating the search in the simplest way:
|
Ok so I found out how to fix this. After noticing that this bug didn't happen on Netlify deploy preview I wanted to understand why. On Deploy preview mode, Netlify adds a "feedback" overlay. That overlay seemed to fix the bug. Conclusion Adding an empty Here is the updated structure of the HTML of our doc page: <!DOCTYPE html>
<html lang="en">
{{ partial "head" . }}
<body>
<div id="wrapper">
<div id="content">
<!--SearchBar-->
<!--Content-->
</div>
</div>
<!--Magic Fix-->
<div class="fixed">
<input type="text">
</div>
</body>
</html> Looking at other issues it probably has to do with But replacing the |
So anything that fills the DOM along with the DocSearch component should fix this issue? This is good to know, thanks for investigating, I'll try to reproduce in multiple cases to see if it's something we can handle |
I don't know if it is anything or a particlular kind element that needs to be focusable by the browser. |
We're having this issue on https://statamic.dev and haven't been able to find a workaround yet. Our open issue: statamic/docs#707 |
Still have no idea why this works though |
Great! |
I've just encountered this issue as well in trying to update Bootstrap's docs to DocSearch 3. See twbs/bootstrap#35736. The problem can be seen in our staging deploy for that PR: https://deploy-preview-35736--twbs-bootstrap.netlify.app/docs/5.1/getting-started/introduction/. Anything else we can do to help debug? |
Hey, thanks for coming back to this @mdo. Are you also testing with Safari 14? I'm not able to reproduce with Safari 15.x anymore edit: managed to reproduce, you need to scroll a bit before hitting cmd k |
Yup, still have it in latest Safari 15. I see it whenever I click into it or Cmd+K. |
It seems that this part is triggered on escape 🤔 I'll try to investigate on the Autocomplete side. (cc @sarahdayan @francoischalifour if you want to double check) |
Likely related: algolia/autocomplete#592 |
@shortcuts Were you able to investigate this further? Let me know if I can be of help at all :). |
As you mention here, the issue is with the focus. So another fix would be to blur the input before closing the modal. This way safari will not try to search for another input to focus and this will also fix the issue. |
This issue also exists on https://remix.run/. When you're at the top of the page in Safari (v16.6) and open and close the modal with |
#### Reference Issues / PRs closes #2004 #### What does this implement/fix? Fixes the quick jump to bottom of the page in safari This is an existing bug in docsearch: algolia/docsearch#1260 #### Any other comments? No --------- Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Description
On Safari, when opening the search modal and then closing it without having made any search, the page scroll to the bottom of the page.
When searching something, it looks like the search box behave nicely.
Safari version: 14.1
Docsearch version: 3.0.0-alpha.42
Enregistrement.de.l.ecran.2022-01-12.a.23.47.27.mov
Steps to reproduce
cmd + K
to open the modalesc
to close itLive reproduction:
https://www.scrapingbee.com/documentation
Expected behavior
It should not scroll to the bottom of the page
Environment
The text was updated successfully, but these errors were encountered: