correctly manage enableKeyboardHandlers flag

[#46750435]