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

FIX: Scroll padding on top for anchor links #669

Merged
merged 10 commits into from
Jan 6, 2023

Conversation

choldgraf
Copy link
Member

@choldgraf choldgraf commented Jan 5, 2023

The failing test is a lighthouse performance check, which is notoriously flaky and I think can be ignored

@choldgraf
Copy link
Member Author

choldgraf commented Jan 5, 2023

@mathbunnyru how does this look to you? Maybe @consideRatio is looking at this as well?

you can see a demo here:

https://sphinx-book-theme--669.org.readthedocs.build/en/669/

@mathbunnyru
Copy link

Thank you for such a quick response @choldgraf!

Now there is some extra text above the anchor.
https://sphinx-book-theme--669.org.readthedocs.build/en/669/notebooks.html#code-blocks-and-image-outputs

Screenshot 2023-01-05 at 18 54 57

@choldgraf
Copy link
Member Author

Hmmm good point - it is a bit tricky to get just right, because if the top padding is too small then we will accidentally highlight the wrong section and the original problem will come back. I reduced the padding at the top in the latest commit to try to strike a balance. WDYT?

@mathbunnyru
Copy link

I think it looks better now, but I still see the text from the previous part. I guess it's impossible to have both things.
Screenshot 2023-01-05 at 19 16 40

@choldgraf
Copy link
Member Author

OK how's this? It means that if we have two headers directly after one another, we might accidentally highlight the second, but maybe that's not such a big deal and also not common.

@mathbunnyru
Copy link

Now it looks great to me 👍

@choldgraf
Copy link
Member Author

OK I cleaned up a few other points that @mathbunnyru noted - will merge this if tests are happy since it's fixing a few bugs

@choldgraf choldgraf merged commit a97f34e into executablebooks:master Jan 6, 2023
@choldgraf choldgraf deleted the fix-padding branch January 6, 2023 10:16
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

Successfully merging this pull request may close these issues.

Anchor links have incorrect offset from top of screen
2 participants