W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2014

Re: [whatwg] Outline style to use for drawSystemFocusRing

From: Rik Cabanier <cabanier@gmail.com>
Date: Mon, 6 Jan 2014 20:01:33 -0800
Message-ID: <CAGN7qDB3FYWzdVPew8a9rWp05h-dJHy7gGdtwS-Cfd43YuKXWw@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>, Dominic Mazzoni <dmazzoni@google.com>, Charles McCathie Nevile <chaals@yandex-team.ru>
On Wed, Oct 16, 2013 at 12:46 PM, Ian Hickson <ian@hixie.ch> wrote:

>
> ...
>
> On Wed, 2 Oct 2013, Rik Cabanier wrote:
> >
> > I don't understand. If the path that is active during
> > drawCustom/SystemFocusRing is off screen and the element is focused, the
> > browser will scroll to that area.
>
> drawCustomFocusRing() and drawSystemFocusRing() shouldn't cause anything
> to scroll. That would be very confusing, IMHO. (When would you scroll?
> Consider the case of the control originally being off-screen on purpose,
> and animating into position. You want the focus ring drawn the whole time,
> and the zoom to follow it maybe, but you only want to scroll once, at the
> start, to the location that it will have at the end.)


I think you misunderstood. The drawCustomFocusRing() and
drawSystemFocusRing() don't cause scrolling, it's when you focus the
fallback element that the browser should scroll.

This does mean that the spec should be updated. Right now, step 1 [1]
states that if the element is not focused, drawSystemFocusRing will abort.
Instead, the browser should update the region of the fallback content and
then continue with step 1.
With some pseudo code:
a. call drawSystemFocusRing

ctx.moveto(...); ctx.lineTo(...); // draw the region of the path

ctx.drawSystemFocusRing(hiddenElement); // element is not focused but
update the region of hiddenElement

b. focus the element (either by tabbing or hiddenElement.focus()) ->
browser should scroll so the focus ring is visible on screen.

I was told the current implementation in Blink already does this.
The Firefox implementation currently does not; however, once an element was
focused, the browser knows about the region of the fallback content and
will do the scrolling. (Webkit would do so as well, but that patch didn't
land over objections from Ryosuke)



1:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawsystemfocusring
Received on Tuesday, 7 January 2014 04:02:00 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:15 UTC