Fix mocking of active element in keyboard tests