Your keyboard is equipped with a proximity sensor that detects your hands whenever you come back to type on your keyboard.
Proximity detection will not work when the keyboard is charging — you have to press on a key of the keyboard to turn the backlight on. Turning the keyboard backlight off while charging will help with the charging time.
The backlighting will stay on for five minutes after typing, so if you are in the dark, the keyboard won't turn off while typing
Once charged and the charging cable removed, the proximity detection will work again.