After a frustrating interaction with a form I whipped up a quick jQuery plugin for developers who don’t want to think about form field focus.
I present to you…
Polite Focus!
It’s a simple idea – use document.activeElement
to determine if an existing field has focus. If not, give your field focus. Otherwise, leave the focus where it is, where someone else (user or previous programmer) decided it should be.
That’s it.
Go forth and use wisely
I’ve created a repo on GitHub so you kids can branch and comment as much as you like.