Keycapture fixing

Fixes bug #41551