Nicolas: If you have a spare moment, could you please take a look at this? Thanks in advance, and thanks for your work to make KDE accessible to Orca users! STEPS TO REPRODUCE 1. Launch Orca in terminal and leave focus there. 2. Press Orca Modifier + H to enter learn mode. 3. Press unmodified letters. 4. Press keys associated with Orca commands (like Orca Modifier + H). OBSERVED RESULT * Everything is spoken twice instead of once. * In the case of unmodified letters, they are input into the focused terminal. EXPECTED RESULT * Everything is spoken once instead of twice. * The unmodified letters would not be input into the focused terminal. SOFTWARE/OS VERSIONS * Linux/KDE Plasma * KDE Plasma Version: 6.5.2 * KDE Frameworks Version: 6.19.0 * Qt Version: 6.10.0 ADDITIONAL INFORMATION This doesn't happen with mutter. When Orca's learn mode is started, Atspi.Device.grab_keyboard() is called. This should presumably prevent the key bleed through, but it doesn't. Looking at the debugging output from Orca, Orca is getting back-to-back key-press events. This is what's causing the double presentation. While I don't have a development environment set up for building and testing kwin, given the behavior I'm seeing, this code in A11yKeyboardMonitor::processKey() makes me a little suspicious: if (data.grabbed) { emitKeyEvent(name, released, mods, keysym, unicode, keycode); } (https://invent.kde.org/plasma/kwin/-/blob/master/src/a11ykeyboardmonitor.cpp#L52-54) if data.grabbed is true, should there be an early return after the event is emitted?
Thanks for the report! I can confirm that your suggestion fixes the issue. I still need to check if it doesn't break anything and ideally write a test for it
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8495
Git commit d9449f01759fdea996c2c57fdc22b2e5851960f9 by Nicolas Fella. Committed on 30/11/2025 at 14:18. Pushed by nicolasfella into branch 'master'. A11yKeyboardMonitor: Fix KeyEvent being emitted too often when grabbing keys When grabbing the keys we should only emit once per key. Reshuffle the code so that we return when we hit the grab condition. We need to handle the case of pressing a modifier twice before that though. Also add more extensive autotesting M +285 -6 autotests/integration/a11ykeyboardmonitor_test.cpp M +6 -4 src/a11ykeyboardmonitor.cpp https://invent.kde.org/plasma/kwin/-/commit/d9449f01759fdea996c2c57fdc22b2e5851960f9
Git commit 6869adf336b4dcac09d31c24397de2419241e64b by Nicolas Fella. Committed on 30/11/2025 at 15:50. Pushed by nicolasfella into branch 'Plasma/6.5'. A11yKeyboardMonitor: Fix KeyEvent being emitted too often when grabbing keys When grabbing the keys we should only emit once per key. Reshuffle the code so that we return when we hit the grab condition. We need to handle the case of pressing a modifier twice before that though. Also add more extensive autotesting (cherry picked from commit d9449f01759fdea996c2c57fdc22b2e5851960f9) M +285 -6 autotests/integration/a11ykeyboardmonitor_test.cpp M +6 -4 src/a11ykeyboardmonitor.cpp https://invent.kde.org/plasma/kwin/-/commit/6869adf336b4dcac09d31c24397de2419241e64b