LibreOffice doesn't allow switching to another application

Fedora Linux 40 (Workstation Edition)
Gnome 46
Wayland

Problem description: If a LibreOffice window is open and I click on the icon of another application in the dock, it doesn’t switch. It flashes for literally a fraction of a second and returns back to the office. In the video, you can see me trying to switch to the commander and then to Chrome by clicking on them with the mouse.

If multiple office windows are open, clicking to switch between them also doesn’t work. The problem is caused only by the office, other applications “release” focus without any problems. Alt+Tab works fine. Also, you can simply minimize the office to make it disappear from the screen.
The video was recorded on Fedora, but the same thing happened on Ubuntu.