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

[whatwg] Should onblur be triggered for hidden nodes?

From: Rob Wu <rob@robwu.nl>
Date: Thu, 8 Jan 2015 12:38:40 +0100
Message-ID: <CAA+18=xtwOv1pdXLr-MGXnb=1n+bhFh0zYsDNpynKGGz8GadBg@mail.gmail.com>
To: whatwg@whatwg.org
The spec of the focusing algorithm [1] is not explicit about removed/hidden
nodes. It seems to allow the change / blur / focusout events to be
dispatched when an element becomes hidden or is removed from the document.

All non-WebKit-based users agents (Trident, Gecko, Presto) do NOT follow
this behavior. I.e. upon node removal, the change/blur/focusout events are
not dispatched.
WebKit and Blink deviate from the other UAs, they do trigger these events (

This discrepancy became even more significant when Blink started to match
other UA's behaviors and focus anchor elements upon click (
crbug.com/388666#c10). Now, out of all browsers that focus an <a> element
upon click, Blink is the only one that triggers the blur event when a node
is hidden/removed. This difference has caused some broken websites and bug

There are two options here:
- Dispatch change / blur / focusout when an element is unfocused,
regardless of whether the element is still in the document.
- Ignore hidden / removed elements in the focusing algorithm; i.e. do not
dispatch these events.

I'm inclined to vote for the second option, because the majority of the
distinct user agents already follow this behavior.
What do you think?

Kind regards,

Received on Friday, 9 January 2015 00:06:43 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:32 UTC