W3C home > Mailing lists > Public > www-style@w3.org > December 2013

Focus State on the Web

From: Matt Gaunt <mattgaunt@chromium.org>
Date: Fri, 13 Dec 2013 15:09:55 +0000
Message-ID: <CABWx_50e3GntkQ0772-FfvQ17DxeveGFdRHB4nW9f91RWKgsiA@mail.gmail.com>
To: www-style@w3.org
Hi Everyone,

(I originally posted this on blink dev but it was highlighted to me that
this would be a more appropriate place to discuss this topic)

I just wanted to open a discussion on why the focus state is being applied
on elements when touched or clicked, rather than just using active state,
resulting in :focus & :focus:active state being reserved exclusively for
keyboard interaction (or other input devices).

I started to look at how the two states work across browsers and the
behaviour is a bit messy on desktop, although fairly consistent on mobile
(apart from Safari).


(I've filed a bug against Chrome for the loss of focus on label element in
Chrome: https://code.google.com/p/chromium/issues/detail?id=326993)

Initially my assumption was that the focus state would only take affect
when using a keyboard and this seems to be what Safari is doing on desktop,
while it requires a setting to enable tabbing on all elements, once
enabled, clicking will only use the active state until you interact via a
keyboard, at which point focus is used. Once you start interacting with a
keyboard and then go back to using the mouse, the focus state will stop
being used.

The obvious exception from this is the input field which is focused when

The main advantage for this approach is you can have more subtle changes in
your UI for touches and clicks and have more drastic calls to action with
the :focus state.

I can't think of any major disadvantage to this behaviour other than if
people are relying on this behaviour today and don't have an :active pseudo

What is the reason for the current behaviour and are there any
accessibility concerns I may be missing? If not could we change the spec'ed
behaviour to be more in line with Safari where focus is reserved for
keyboard input?

Matt Gaunt
Received on Friday, 13 December 2013 16:19:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:37 UTC