Change in behavior in Sonoma

I wrote a few hotkeys for mouse control. I put them in a group, and I have other hotkeys for activating and deactivating that group. Previously deactivating the group worked fine, but once I upgraded to Sonoma I noticed that the O.S. "defocuses from" the front window upon deactivating the mouse group... i.e. it won't receive keystrokes and I get an error beep when typing.

I quickly tried adding some code to raise the "front window of the front application" in my macro that deactivates the group, and that seemed to fix it.

But I haven't tested it much. I'm wondering if this sounds like the correct solution.

I'm also wondering why this behavior change happened when upgrading to Sonoma.

I can provide code if necessary, although I'm not sure how you would want me to upload it to this forum.

Unfortunately I found a situation where this behavior causes a major problem. When you click on a file in Finder to rename it (and it changes to an input field), then I deactivate my mouse macro group, the filename turns solid again and can't be typed into without reselecting it. That's not too bad because you can hit Enter at that point to go into rename mode, but I'm getting similar behavior with my IDE (VS Code) that is a major problem and means I can't avoid using the mouse, which I am trying to avoid due to hand pain.

It appears in Sonoma the front window is deactivated when the Toggle Activation window is shown.

I suggest you turn off displaying the toggle and I'll see if I can figure out how to avoid the deactivation.

okay I turned off displaying the toggle.