How to fix MacBook Pro (2018 13 ") keyboard delay?

I noticed that there is a slight delay (~ 1 second) when entering text after the keyboard's backlight turns off.
I started to turn off the keyboard lights after 10 seconds of inactivity (screenshot attached).
enter the description of the image here

Any help to solve the problem is appreciated.

EDIT: I also noticed that this delay is global when the black lights go out and also when it is turned on again when it is being written. YouTube and many other elements on the screen are hung and resumed.