Comments (6)
Is the issue due to the definition of the scrollNav()
function?
just-the-docs/assets/js/just-the-docs.js
Lines 502 to 503 in 4e7f834
When JS is disabled, the position of the clickable area appears to be correct in Safari/macOS:
from just-the-docs.
Thanks for submitting an issue! I actually am unable to reproduce this locally, but I might be missing some information. Could you let me know the size of your viewport? I'm also on macOS Ventura with the latest stable Safari, etc.
from just-the-docs.
It's easiest to see the effect when the viewport width is 840 or 980. On my 13" laptop, that's zoom levels 4 and 3, I think.
It's necessary to avoid manually scrolling the nav panel at all after clicking on the Configuration link: scrolling a bit then back again appears to correct the placement (which is why I suspect our automatic scrollNav()
causing the issue when the nav panel is already at the top).
And to repeat the issue, one needs to select a different page first (since the Configuration anchor is inactive after selecting it).
from just-the-docs.
I suspect our automatic
scrollNav()
causing the issue when the nav panel is already at the top
And after commenting-out the call of scrollNav()
locally, the reported issue disappears.
Perhaps the call to scrollBy
should be skipped when the nav panel can't be scrolled any further?
from just-the-docs.
Oh! Thank you for reminding me of not scrolling - I must have done that inadvertently (or perhaps it was that and a combination of the viewport on my monitor). I can confirm at zoom levels 3/4, with the viewport range you provided, that the clickable area is incorrect.
I can do some more investigating as well - the scrollNav()
hint is helpful. I wonder if there is some undefined behaviour that we're relying on, a known webkit bug with rendering, or something else. For American Thanksgiving I'll be dedicating some time to JtD, so expect an update then!
from just-the-docs.
Okay, I've done a bit more investigation. Just to sum up some interesting notes:
- as expected, the bounding rect itself (from
.getBoundingClientRect()
) is identical on Safari, Firefox, and Chrome when zoomed in (or not) - after fiddling around with the values/offsets (e.g. the height multiplier, fixing it to a constant), this problem still persists on Safari
- after doing a (minimal) google search, variants of this bug (zoom +
scrollBy
not working as intended) have appeared before, such as webkit #45228 - though it doesn't seem like there are any relevant open bugs on the webkit bug tracker (see: "scrollTo zoom" and "scrollByZoom")
Separately, I also realized that the scrollIntoView
function has stabilized (see: caniuse), which makes me feel a bit old (I distinctly remember reading the Chrome changelog with the release). Using that instead:
- fixes the bug
- makes the logic for the overall method simpler
I'll open a PR to demonstrate!
from just-the-docs.
Related Issues (20)
- Wrong contents in Figure 3 HOT 1
- 0.6.0 longer build time HOT 6
- Info emoji does not render as a picture HOT 10
- Search is broken on endoflife.date after upgrading to 0.6.0 HOT 10
- Investigate using TypeScript for Just the Docs JavaScript
- Faster build speed by caching the sidebar HOT 1
- Improve GitHub Issue Templates
- Mobile Menu Not Working HOT 5
- Callouts not rendering HOT 3
- nav_external_links > opens_in_new_tab: true doesn't open the link in a new tab HOT 4
- Add support for additional diagram languages HOT 4
- Dependency error HOT 3
- Navbar highlighting depends on URL having `.html` extension HOT 1
- light vs dark theme based on device setting HOT 1
- Add in-page right sidebar HOT 3
- `just-the-docs.com` copyright is out of date HOT 4
- big HOT 1
- Add support for Lunr pre-built indexes HOT 3
- Zion LLC HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from just-the-docs.