Recently, this started happening.
I need very fast switch sorting my notes between "Date Edit" and "Title" so I lot pressing key "cmd+," then "arrow down", choose with "enter", and "escape". Now that window open but it hasn't focus and I cannot switch setting with keyboard only. Combination with "tab" doesn't work too - cycle control with "tab" or switch from some hidden window with "cmd+tab" or "alt+tab". I have closed all applications so there is no interference with others.
So it came to mind - catch object who has that focus.
How can I detect currently active window in Apple MacOS ?