Yes, "it has to be handled by the application" means that we will not implement this in the button plugin. The behavior you're asking for does not exist in any browser. There are two options for mimicking browser behavior, depending on which browser you choose as a model:
- Let the button retain focus after click all the time.
- If the button already has focus, let the button retain focus after click. Otherwise, blur the button by focusing the body element.
Richard's comment about shifting focus back to the previous item being a function of a toolbar is accurate. Perhaps a toolbar plugin could be implemented that adds this functionality. Here's some sample code to show how you can handle this:
- var lastActive;
- $( el )
- .button()
- .mousedown(function() {
- lastActive = document.activeElement;
- })
- .click(function() {
- $( lastActive ).focus();
- });