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

BCV Selector doesn't scroll the first time after refresh #900

Open
tjcouch-sil opened this issue May 19, 2024 · 0 comments
Open

BCV Selector doesn't scroll the first time after refresh #900

tjcouch-sil opened this issue May 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tjcouch-sil
Copy link
Member

tjcouch-sil commented May 19, 2024

Describe the bug
The first time you open the BCV control for the first time after loading or reloading, it doesn't scroll to the selected book heading. Note: this is not always easily reproducible. Ian Hewerdine has mentioned he can get it consistently, so maybe you can refer to him when investigating.

To Reproduce
Steps to reproduce the behavior:

  1. Open Platform.Bible or Ctrl+R
  2. Click on the BCV selector
  3. Notice it doesn't scroll to the selected book
  4. Click off to close the selector
  5. Click on the BCV selector again
  6. Notice it scrolls to the selected book

Expected behavior
It scrolls properly on first open


TJ has done some significant testing and playing around and has left his work that didn't succeed in 426d2e0...bcv-scroll-fix

(Here is the compare link for the whole branch, but the first commit is in #899)

It looks like the problem in the work on the branch linked above is that offsetTop doesn't get set properly soon enough. Very strange. I saw online somewhere that some claim offsetTop doesn't get set until the document lays out properly and all. However, this is running on useLayoutEffect, so I am confused. We were seeing this same problem before, so we made isContentOpenDelayed to try to combat the problem. But some users are still seeing the issue. Very confusing.

I thought the problem not showing up in the platform-bible-react preview was due to having Strict mode enabled, but I recently tried again and saw that it has the same functionality either way. I can't get it to reproduce on my machine :(

@tjcouch-sil tjcouch-sil added the bug Something isn't working label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant