- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Wed, 23 May 2012 09:00:13 -0700
- To: Thaddee Tyl <thaddee.tyl@gmail.com>
- Cc: www-style@w3.org
On Tue, May 22, 2012 at 3:17 PM, Thaddee Tyl <thaddee.tyl@gmail.com> wrote: > A common pattern in the web is to use `element.scrollIntoView()` to > show that element > in the context of the web page. However, the design of scrollIntoView > puts that element > either at the very top or at the very bottom of the viewport. > > In most cases, web authors want to center that element. As a result, > there is great duplication > of code to make that work, and scrollIntoView gets rarely used, except > for quick and dirty > implementation of a search functionality. > > I suggest a solution to that in the following bug, copy and pasted below. > > All feedback is warmly welcome! > > https://www.w3.org/Bugs/Public/show_bug.cgi?id=17152 [sni] > I therefore suggest the following addition: > > partial interface Element { > void scrollIntoView(ScrollPosition options); > }; > > dictionary ScrollPosition { > float top = 0.5; > float left = 0.0; > boolean notIfViewed = true; > }; I strongly support this. I honestly have no idea how the WebKit person who designed the scrollIntoViewIfVisible() function justified their work, besides "it was the easiest way to achieve exactly what I was asked for". This API makes sense to me. ~TJ
Received on Wednesday, 23 May 2012 16:01:06 UTC