Window function bringtofront() grabfocus() restore() not working as expected

I’m closing this ticket and we will continue to handle the matter on the other ticket: