That is a feature. Allowing arbitrary programs to read any key press is how you get keyloggers.
Wayland has a protocol to request reading keys out of focus (which will ask the user for permission, as opposed to just read it like on xorg).
If the program was running in xwayland (which it probably was) of course it won't use that protocol, and will just try to read it X11 style.
In some DEs (KDE) you can select if X11 apps are allowed to read keys.
"I switched to X11 and it immediately works". I'll give you another tip: if you run chmod 777 -R / the file manager stops pestering about permissions and it immediately works.