New Input System bug

Hello everyone. Recently I encountered a problem with the new input system. When trying to read data from the mouse, a bug occurs. In the “play focused” mode, a piece of code does not work, but in the “play maximized” mode everything works. How to solve this problem? It causes inconvenience during development (I know that you can use the classic input system, but I want to understand how to solve the problem with using the NIS).


using UnityEngine.InputSystem;

public class Test : MonoBehaviour
{
    private void Update() {
       
        if (Mouse.current.leftButton.wasPressedThisFrame) {
            Debug.Log("CLICK");
        }

    }
}

Other than the unityengine using missing this script works for me