Check focus using document.activeElement

This provides a more stable test for the current focus. It does not work always (this is a karma issue), but much better than jQuery's .is method.