Unanswered: events in the wrong order

Unanswered: events in the wrong order

I have a situation where the events I need are coming in the wrong order.

I am writing a grid which mimics the Excel UI. when I edit a grid cell and click on the formulabar above, I don't want the grid cell to go out of editing mode. Therefore, I need to intercept the onBlur() method. if formulabar was the one which triggered the onBlur, I want to skip blurring the grid cell, and therefore keep it in editing mode.

The problem is both formulabar.onFocus() and formulabar.onClick() methods on the are called after the gridcell.onBlur() method, so I can not conditionally blur my gridCell.

is there a way I can delay the gridcell.onBlur() call til after formulabar.onFocus(), or alternatively, get the formulabar.onFocus() event earlier?

Click and Blur are dom events, fired by the browser itself. Changing your code usually isn't enough to reorder how those events fire - when a user clicks on something not in focus, first the currently focused thing must be blurred. Understanding it this way will hopefully lead to this solution - cancel the blur event, and the newly focused thing shouldn't be focused.