3 ms·
Nothing in the DOM spec indicates that there are scroll bars or anything else about how the user is interacting with the scrolling position of the page. The win
by pdkl95 12y ago
Nothing in the DOM spec indicates that there are scroll bars or anything else about how the user is interacting with the scrolling position of the page. The window.scroll* functions talk about pixel or line dimensions, and not how the user's scrolling interface works or how the user interacts with that interface.
For example, some common methods are:
* scrolling with a mouse by clicking on a traditional scrollbar
(this is what is being reimplemented)
* using a scroll wheel or trackpad drag
(compatibility is *often* added for this, but not always)
* dragging touchscreen (support varies, getting better)
* using the arrow keys (sometimes supported)
..and a few of that almost always break when scrolling isn't left to the user agent:
* PageUp/PageDn
* some other key to page down, such as the space bar
* a browser extension to auto-scroll the page slowly
* accessibility tools of various types
* no javascript support
* the foot pedal I made out of MIDI keyboard sustain pedals and an
old USB keyboard that is mapped to a non-standard X KeySym and
bound as an alias to PageDn in firefox (it's Meta in emacs)
* the scrolling UI for next year's Cool New Gadget that we cannot
support because the device doesn't exist yet, but the manufacturers
of the device can add support for standard HTML/DOM features
Also, even in the case where the UI method is guess correctly, the details may be different. For example, I set firefox's mousewheel.default.delta_multiplier_y to 500 so each scroll wheel click is a much larger movement of the page, because my mouse wheel is not a mouse wheel - I use thumb buttons for scrolling because the normal wheel was causing RSI problems.
The basic problem is a common misconception about what HTML, where the client (via their User Agent) controls the presentation. As they are in the hands of the users, there will always be a lot of variation as those users tailor their tools to their personal needs. The only way to maintain any particular presentation feature across all clients is to turn the WWW back into TV. The alternative is learning what can be specified by the page (pixel scroll position) and what is NOT in the spec (how the user and their User Agent interact), while remembering that any of these features may not be implemented the way you think they are.