Bug 512189 - Orca's learn mode results in double presentation and key bleed through
Summary: Orca's learn mode results in double presentation and key bleed through
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: accessibility
Depends on:
Blocks:
 
Reported: 2025-11-16 13:53 UTC by Joanmarie Diggs
Modified: 2025-11-30 17:39 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.5.4
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joanmarie Diggs 2025-11-16 13:53:46 UTC
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?
Comment 1 Nicolas Fella 2025-11-16 16:14:35 UTC
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
Comment 2 Bug Janitor Service 2025-11-27 20:15:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8495
Comment 3 Nicolas Fella 2025-11-30 15:35:22 UTC
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
Comment 4 Nicolas Fella 2025-11-30 17:29:46 UTC
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