[cssom-view] scrollIntoView exhibits cultural bias

The current description of how to scroll an element into view
(http://dev.w3.org/csswg/cssom-view/#scroll-an-element-into-view)
seems very left to right, top to bottom centric.  In particular, the
algorithm seems to me to do the most expected thing only when the
context is left to right, top to bottom and the content is in or below
the viewport.

In particular, I would expect that:
(a) in addition to being able to force top or bottom alignment, one
could also independently force left or right alignment, and
(b) in each (vertical and horizontal) case, if no preference is set,
correct behavior would be to scroll the minimum amount needed to bring
the element into view (so if the element is currently off the top, it
would be aligned to top, even though the "alignToTop" argument is not
specified) and, if the element cannot fit completely, that the "start"
of the element be brought into view with as much of the rest of the
element visible as possible, so that, e.g., the right edge of a
paragraph would be shown, if that paragraph were marked as
right-to-left.  (Some elements may have other mechanisms for
determining the "start" -- a graphic might use the origin of its
co-ordinate system, or the first item rendered, etc.

I would recommend, then, that the flag either be replaced with some
other, more flexible argument list, or if backwards compatibility must
be maintained, the flag be re-defined to force the start of the
element to align with the corresponding part of the viewport as,
implied by the locale settings of the element.

Also, I would like to see a mechanism for specifying an upper-most
ancestor that causes the algorithm to terminate, so that one could
scroll an element into a viewport that is currently offscreen without
having to bring that viewport on screen.  This might be better as a
method of the scrolling box; e.g. .scrollToContent(contentElement,
options).

..

Vynce

..

Received on Thursday, 14 October 2010 15:49:46 UTC