W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2012

Re: [whatwg] Should scrollbars move focus?

From: Ojan Vafai <ojan@chromium.org>
Date: Thu, 1 Nov 2012 10:45:07 -0700
Message-ID: <CANMdWTs0nC4mM7vCG0+tMEfYrCqJfsECmWaPJL=RjRVezJDx1g@mail.gmail.com>
To: Peter Kasting <pkasting@google.com>
Cc: WHATWG <whatwg@whatwg.org>, Elliott Sprehn <esprehn@gmail.com>, Ian Hickson <ian@hixie.ch>, Robert O'Callahan <robert@ocallahan.org>
On Wed, Oct 31, 2012 at 4:17 PM, Peter Kasting <pkasting@google.com> wrote:

> On Wed, Oct 31, 2012 at 4:08 PM, Ojan Vafai <ojan@chromium.org> wrote:
>
>> On Wed, Oct 31, 2012 at 3:46 PM, Robert O'Callahan <robert@ocallahan.org
>> >wrote:
>> > I think what's happening here in Gecko is that a click on a focusable
>> > element moves focus, and a click on an element's scrollbars counts as a
>> > click on the element. So clicking on the scrollbar of a <textarea> or
>> > contenteditable <div> (or even a <button> containing content with a
>> > scrollbar, if you're mad) moves focus to that element. I think this is
>> > quite reasonable actually.
>> >
>> > Example: http://people.mozilla.org/~roc/scrollbar-focus.html
>>
>> I see. Thanks for the clarification. I don't feel strongly about this.
>> Either direction seems fine. Although, it doesn't violate every native
>> platform's scrollbar convention.
>>
>
> The behavior Robert describes seems theoretically reasonable to me as well.
>

On the one hand, I think it'd be more consistent if clicking on scrollbars
just never moved focus. Here's a case that's kind of weird if you do move
focus:
<div tabIndex="-1" style="width: 100px; height: 100px; overflow: auto">
    <input>
    <div style="height:200px"></div>
</div>

If you focus the input, then click on the scrollbar, the input gets blurred.

I suppose the opposite case is worse though:
<div contentEditable style="width: 100px; height: 100px; overflow: auto">
    <div style="height:200px"></div>
</div>

Clicking on the scrollbar wouldn't focus the element, so you wouldn't get a
text input cursor unless you clicked inside the scrollable area.

I remain on the fence. :)


> Ojan, can you say how you tested the platform conventions?  On Windows I'm
> having a hard time finding an app with multiple scrollable elements that
> uses native scrollbars.  (For example, Visual Studio doesn't use native
> scrollbars.)
>

I didn't test nested scrollbars in Windows. I believe Elliott may have. I
did test them on Mac and Ubuntu. Clicking on nested scrollbars doesn't move
focus even if the scrollable element is focusable. On Ubuntu, clicking on
scrollbars doesn't even change window focus if the scrollbar is in a
different window.
Received on Thursday, 1 November 2012 17:46:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT