W3C home > Mailing lists > Public > public-html-comments@w3.org > April 2008

Re: [whatwg] scrollIntoView jarring?

From: Peter Kasting <pkasting@google.com>
Date: Wed, 30 Apr 2008 13:18:21 -0700
Message-ID: <d62cf1d10804301318r7226e41cle3c17c109bfb12f8@mail.gmail.com>
To: "David Bolter" <david.bolter@utoronto.ca>
Cc: whatwg@whatwg.org, "W3C WAI-PFWG" <w3c-wai-pf@w3.org>, public-html-comments@w3.org
On Wed, Apr 30, 2008 at 10:58 AM, David Bolter <david.bolter@utoronto.ca>
wrote:

> Specifically I would ask that:
>
> 1. scrollIntoView not do anything in the case that the element is already
> fully visible (possibly in the middle of the viewport), or
> 2. ensureElementIsVisible to be added as described by Daniel Glazman (
> http://lists.w3.org/Archives/Public/public-html/2007Nov/0188.html)


I agree that this is a use case which scrollIntoView does not seem to solve
well.  I am not sure Daniel's proposal for ensureElementIsVisible is perfect
either, though it is clearly better.

I make no formal proposal, but the behavior I would typically want for some
kind of a call (perhaps in addition to those above, I don't know) would be:

   - If the element in question cannot be scrolled so as to make more of it
   appear in the viewport, do nothing.  (For when the element is completely
   visible, or is larger than the viewport and already taking up the whole
   viewport).
   - Otherwise, if the element is not larger than the viewport, scroll such
   that the element is centered* in the viewport (within the scrolling limits
   -- if the element is at the bottom of the page, it clearly can't be scrolled
   up to the middle of the viewport).
   - Otherwise, scroll the element such that the top of the element is
   aligned with the top of the viewport.

*Perhaps centered is the wrong choice.  Another suggestion would be to
scroll to a point 1/3 of the way from the top or bottom of the viewport,
nearer to whichever edge the element scrolled in from.  Also, perhaps the
UA's behavior should not be specified in this kind of detail?

PK
Received on Wednesday, 30 April 2008 20:19:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 1 June 2011 00:13:58 GMT