We would have to do the delay for buttons that have server callback actions because in real-time scenarios, buttons can perform any actions - we do not actually know which one would invoke a fetch - would you see this as a problem?
Since it's quite a specific case our assumption is that you can apply it to the specific button within your app where you've encountered the problem, rather than trying to apply it generally to every button.
If in your case the sequence of events involves an asynchronous server request (triggered from a button click) actually kicking off the setDataSource() / fetch operation that causes focus to be lost by the button, you could have the callback from that server request check whether the button has focus (looking at button.hasFocus), and if it does, use this same workaround code (button.delayCall("focus")) to ensure focus is reset to the button.
If you find this doesn't work as expected within your app, or is not practical to apply for some reason, let us know.
Comment