Re: [cssom-view][css-snappoints] scrollIntoView() with block/inline offset

On Tue, 26 Jan 2016 09:28:11 +0100, Sebastian Zartner  
<sebastianzartner@gmail.com> wrote:

> On 25 January 2016 at 12:07, Merih Akar <merih@zeplin.io> wrote:
>>
>> I searched the archives but couldn't find any discussion about this:
>>
>> Sometimes I feel the need to scroll an element into the view with some  
>> offset so that it's not completely aligned with it's container, and  
>> visually in a more appropriate place. Because of this, I abandon using  
>> scrollIntoView() and use scrollBy()/scrollTo() with the element's  
>> bounding client rect plus/minus that offset. What would you think about  
>> adding two new options to ScrollIntoViewOptions such as blockOffset and  
>> inlineOffset which will be the distance between the element and its  
>> container after the element is scrolled into view?
>
> This was already mentioned before[1], though didn't get any response,
> as far as I can see. I personally support this idea.

I agree that it would be useful, but I think it would also be useful for  
normal in-page navigations, e.g. when there is a position:fixed header.  
Would it be better to start with a CSS property to control scroll offsets,  
and see if it's still necessary to add something more to scrollIntoView?

> Another way would be to extend this API to allow to scroll to some
> scroll snap point.

Yeah, that was discussed in some other thread and I hope to put it in the  
spec soon.

cheers

> Sebastian
>
> [1] https://lists.w3.org/Archives/Public/www-style/2012Jun/0455.html
>


-- 
Simon Pieters
Opera Software

Received on Wednesday, 27 January 2016 13:12:53 UTC