3 ms·
> whereas in such an application you would probably prefer it to scroll one column horizontally or one row (though maybe more than one) vertically. But isn't t
by cookiengineer 6y ago
> whereas in such an application you would probably prefer it to scroll one column horizontally or one row (though maybe more than one) vertically.
But isn't this exactly what element.scrollIntoView() is supposed to be for?
Native scrollbars, styled with scrollbar-width and textareas resizing with cols attribute is pretty straight forward if you do the box-sizing right.
- chrismorgan 6y agoI think you’re misunderstanding. I’m saying that on platforms where the native scrollbar has arrows that you can click to scroll by a small amount in the nominated direction, you might prefer clicking on those arrows to do something different—to scroll one row or one column, whatever distance may be, rather than however many pixels the user agent decides. But you can’t do that on the web. element.scrollIntoView() is completely unrelated to this.
- cookiengineer 6y agoAh gotcha, yes you are indeed correct. Something like custom amount of lines to scroll isn't possible afaik. I was just stating that with scrollIntoView and the element's scroll-snap-align and scroll-padding/scroll-margin CSS properties you could set the wanted offsets and alignments of the scrollbar and define what you were argueing about. But of course, you cannot influence the behaviour of the scrollbar arrows themselves. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-align https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap...
- chrismorgan 6y agoAh, CSS scroll snapping. Refer to my other comment in this thread about that, I strongly recommend against using it for layout matters like this, it messes with the scrolling behaviour (especially on devices with precise-scrolling touchpads and inertia) something fierce; it’s quite unavoidably every bit as bad as doing the scrolljacking in JS.