This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25897 - focusin and focusout should be included in the "focus update steps"
Summary: focusin and focusout should be included in the "focus update steps"
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: 2014 Q4
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on: 25877
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-27 19:57 UTC by Travis Leithead [MSFT]
Modified: 2018-02-27 10:52 UTC (History)
9 users (show)

See Also:


Attachments

Description Travis Leithead [MSFT] 2014-05-27 19:57:16 UTC
+++ This bug was initially created as a clone of Bug #25877 +++

Presumably, focusin fires immediately before focus in the algorithm, and focusout fires immediately before blur in the algorithm (neither are cancelable).
Comment 1 Ian 'Hixie' Hickson 2014-05-28 05:45:50 UTC
Apparently Chrome/IE support these, and Firefox is considering implementing it:
   https://bugzilla.mozilla.org/show_bug.cgi?id=687787

If we could get away with removing this from Chrome, it seems like that would be a win. It's not clear what focusin/focusout add that focus/blur don't.
Comment 2 Ian 'Hixie' Hickson 2014-05-28 05:49:56 UTC
Pinged Chrome devs about maybe dropping this:
   https://code.google.com/p/chromium/issues/detail?id=378163
Comment 3 Ian 'Hixie' Hickson 2014-05-29 21:02:52 UTC
Travis, is there a compat need for these?
Comment 4 Travis Leithead [MSFT] 2014-05-29 21:22:04 UTC
(In reply to Ian 'Hixie' Hickson from comment #3)
> Travis, is there a compat need for these?

I had data years ago (when I asked to have them added to DOM L3 Events in 2009 [1]), but don't have recent data. I can see about gathering that for you though... :)

[1] https://dvcs.w3.org/hg/dom3events/rev/6d85eb1847a4
Comment 5 Ian 'Hixie' Hickson 2014-05-30 18:25:26 UTC
Do you recall what your 2009 data said?
Comment 6 Travis Leithead [MSFT] 2014-05-30 18:39:23 UTC
No, but I just re-tested on 2014 data.

In a relatively small sample size of "top sites" in world-wide geographic areas I found the following data for focusin and focusout usage (e.g., registration of these events):

focusin usage:  117,588 / 569,726 (20.6%)
focusout usage: 117,430 / 569,726 (20.6%)

jQuery looks to be one of the major contributing factors...

In the jQuery 1.11.1 uncompressed file, the following is quite telling:

(function() {
  var i, eventName,
  div = document.createElement( "div" );
  // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event)
  for ( i in { submit: true, change: true, focusin: true }) {
    eventName = "on" + i;
  [...]
Comment 7 Ian 'Hixie' Hickson 2014-05-30 21:48:12 UTC
So if we remove support, jQuery would keep working?
Comment 8 Ian 'Hixie' Hickson 2014-08-05 19:43:06 UTC
This is pending UseCounter data from Chrome. However, I'm not sure that data is going to be that useful. We know the events are used. The question is would pages break if the support was removed, given that many pages fall back to focus/blur.
Comment 9 Ian 'Hixie' Hickson 2014-09-11 23:03:32 UTC
foolip: You're king of the feature removal, any interest in removing these redundant focus events? If I can't convince you, then I should just add them to the spec.
Comment 10 Philip Jägenstedt 2014-09-25 08:07:43 UTC
The use counter for focusin/focusout reached stable a few weeks ago:
http://www.chromestatus.com/metrics/feature/timeline/popularity/433

At 3-4%, removal does not seem feasible.

There's also a use counter for DOMFocusIn/DOMFocusOut:
http://www.chromestatus.com/metrics/feature/timeline/popularity/211

That's currently around 0.2%, and if nobody else implements it and most content listens to both just to be safe, eventual removal seems possible.
Comment 11 Olli Pettay 2015-09-02 10:58:53 UTC
I doubt this is a "good first bug", given that focusout/in may change focus or remove to-be-focused element from DOM and whatnot.
Comment 12 Olli Pettay 2016-05-21 21:26:28 UTC
FWIW, looks like focusin/out have been implemented in Blink (at least) totally differently to what the spec says (and what IE does), so we may need to change the spec :/
Comment 13 Anne 2018-02-27 10:52:35 UTC
This is now tracked by https://github.com/whatwg/html/issues/3514.