I am implmenting a formula editor, which opens on a click, and parses the resulting formula on focusout. However, I would like to ignore focusout if it is generated by a click on various other “clickable” things: for instance, there is an autocomplete box, a help box with internal links, a message box…
What is the best design to figure out if a view or component that handles click has been clicked on without coupling all of the implementation of all the components?
One thought was to force them all to define “clickable” html class (which is already some coupling but perhaps not so severe, then have the app handle “mousedown” (which should fire before focusout – I don’t see that click and focusout have a guaranteed order). In the mousedown handler I’d set a property that said whether the last click was clickable.
This has several drawbacks (for instance, I’d want to clear the property with a delay perhaps? … how do I know that the focusout and the mousedown are related…). Is there another way? Can I find a list of event handlers somewhere, to avoid the coupling?
Any thoughts welcome; thanks!