Skip to content
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

Does not scroll to result on current page in Safari #1397

Open
IanVS opened this issue May 27, 2022 · 1 comment
Open

Does not scroll to result on current page in Safari #1397

IanVS opened this issue May 27, 2022 · 1 comment

Comments

@IanVS
Copy link
Contributor

IanVS commented May 27, 2022

Description

I find that using safari 15.4, trying to navigate to a search result that is on the current page does not work. There's a bit of flicker on the page, so perhaps it is scrolling to the correct location, but then it scrolls immediately back to the top. Setting scroll-behvaior:smoooth; prevents this, but causes other issues (closing the search modal causes a jump to bottom and scroll back to the top).

This might be somewhat related to #1260.

I also wonder if

window.scrollTo?.(0, initialScrollY);
could be causing the issue.

Steps to reproduce

  1. Go to https://docs.astro.build/en/getting-started/
  2. Open the inspector, click on the html element, and find where scroll-behavior: smooth is set, and disable it. (it's set on :root in a media query)
  3. Click on the search box in the top
  4. Search for "join our community" (which is lower down on the page
  5. Notice that the page does not navigate to the section.
  6. Refresh the page so that scroll-behavior is reset, and try again.
    7. Notice that it works.
    I take it back. It only works sometimes.

Expected behavior

Should be taken to the correct location in the current page

Environment

  • OS: macOS
  • Browser: safari 15.4
  • DocSearch version: 3.1.0
@IanVS
Copy link
Contributor Author

IanVS commented May 27, 2022

I did a little more experimenting. If I remove the line I mentioned above, window.scrollTo?.(0, initialScrollY);, that indeed fixes this particular problem, but it causes #1260: when I close the modal without choosing a result, I scroll to the bottom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant