This is best demonsrated by Notifications' badges; when first loading a page, if the user clicks the badge before the JS is loaded, the system didn't have "time" to take over the click handler to open the popup -- so the result is that the badge link is activated and the user is redirected to Special:Notifications. This is super annoying, and it's not the behavior we'd like to see for users clicking the badge. If they don't have JS enabled, the link should still work, though.
This task is meant to discuss potential solutions to this problem. Attached is an initial idea that allows the use of a "deferredAction" method to trigger the action later. It safely creates an onClick handler that collects the click behavior, and allows the component to request the clicks (or in the case of Notifications, the latest click only) and then act on it. If JS is not enabled, the onClick is obviously ignored.
There are still issues with this patch, so take into account it's a preliminary idea; there are several more ideas on the table to consider, as well, and we should discuss and see if we can come up with a good relatively generic way to solve this problem for other components that need to defer action for clicks -- perhaps even outside of "personal tools" in general.