When the FocusOut event is raised, how do you know which element receives the focus?
The correct way seems to be to use the event\'s relatedTarget p
I have a hypothesis and workaround for firefox. document.activeElement seems to work. Then focusout hits, so it gets removed. By the time focusin hits (or maybe immediately after) there will be a focused element again. But between out and in there is nothing focused, so no element is being reported as active.
My workaround is a stupid setTimeout hack. setTimeout( function() {console.log(document.activeElement)}, 1);
reliably gets me an active element. Granted I've only tested in one machine and spent all of 90 seconds doing so, but it's the best I've found so far.