fix extra keydown handler registration, fixes #17825
(cherry picked from commit 62218835968063aed384b2d0291c672fbb7183dc)