This does work, but I think this should be done in mouse up events rather than right here. Try with tabs in the browsers and other editors. All of them work on mouse ups.