Description
Bug Report
Scroll implementation does not account for floating point values returned from getBoundingClientRect()
:
docsify/src/core/event/scroll.js
Line 21 in c2d12ed
The result is that scroll event end values will be 1px less than expected because some browsers ignore the value after the decimal point (e.g. 1234.567
is process as 1234
instead of being rounded up to 1235
). Values returned from getBoundingClientRect()
should be wrapped in Math.round()
to ensure consistent behavior.
Steps to reproduce
I noticed this bug on the docsify-themeable website while testing the docsify-sidebar-collapse plugin for a separate issue (I'm not adding this plugin to the docsify-themeable website). I noticed that when some headings were scrolled to the top of the screen they were 1px away from the top edge.
Mention the docsify version in which this bug was not present (if any)
All versions up to current (4.11.6)