Closed FlowIT-JIT closed 1 year ago
The problem relates to the following code: https://github.com/Jemt/Fit.UI/blob/11837398058ed6e606a84231c0a4ffd28c2745f4/Controls/DropDown/DropDown.js#L167 The code closes the pulldown menu when a click outside of the control is registered.
We could postpone event registration - that will allow for any ongoing event to finish executing - although the use of setTimeout is always a bit ugly. Make sure to add comments explaining why!
Also, make sure to guard against the unlikely event that the control gets disposed while waiting for event registration to occur!
Event registration is now being postponed. It now works as expected - the pulldown menu opens: https://jsfiddle.net/e51zoqvx/
Please see the following demostration: https://jsfiddle.net/c0jytfkz/
Click the red "synthetic" dropdown control which gets replaced with a real dropdown control. Notice how dd.OpenDropDown() is called in code, but the pulldown menu remains closed.