Bug 506715

Summary: Keys for Orca (screen reader) structural navigation don't work correctly when pressed multiple times subsequently
Product: [Plasma] kwin Reporter: Michael Weghorn <m.weghorn>
Component: inputAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: duha.bugs, m.weghorn, nate
Priority: NOR Keywords: accessibility
Version First Reported In: 6.4.80   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 6.4.3
Sentry Crash Report:
Attachments: Sample document with a few headings that can be used to reproduce the issue

Description Michael Weghorn 2025-07-07 11:37:00 UTC
Created attachment 183036 [details]
Sample document with a few headings that can be used to reproduce the issue

SUMMARY

The current development version of Orca introduced support for structural navigation for all apps (not just web documents). commit: https://gitlab.gnome.org/GNOME/orca/-/commit/1a10f8c5c738d0cedb2c82a85f14724d23af6f99

However, while jumping to the next heading in LibreOffice using that feature works reliably in a GNOME Wayland session, it only works "sometimes" in the current development version of KDE Plasma (Wayland).
It turns out it doesn't work when the same key is pressed twice (or more often) subsequently without waiting for some time (e.g. a few seconds) in between they key presses.


STEPS TO REPRODUCE
1.  build and run the current development version of the Orca screen reader ( https://gitlab.gnome.org/GNOME/orca )
2. start the GTK 3 version of LibreOffice using `SAL_USE_VCLPLUGIN=gtk3 libreoffice --writer`
3. open the attached sample document containing three headings (or simply insert a few headings into a new Writer document instead)
4) press Orca_Key + Z to enable Orca's document mode (structural navigation mode) (Orca_Key is usually Keypad_Insert or Insert); Orca should announce "Document mode"
5) press H to jump to the next heading
6) press H a few more times without waiting in between
7) wait a few seconds
8) press H again

OBSERVED RESULT

The first time that H is pressed, focus jumps to a heading.
On subsequent times, a literal "h" is inserted at the current caret/cursor position in step 6 instead of jumping to the next heading.
In step 8 (i.e. after waiting), focus jumps to the next heading as expected.

EXPECTED RESULT

Jumping to the next heading should work in step 6 as well, i.e. it shouldn't be necessary to wait a while before pressing H again to jump to the next heading.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 13
KDE Plasma Version: 6.4.80
KDE Frameworks Version: 6.17.0
Qt Version: 6.11.0
Kernel Version: 6.12.33+deb13-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 32 × 13th Gen Intel® Core™ i9-13900HX
Memory: 64 GiB of RAM (62.5 GiB usable)
Graphics Processor 1: Intel® Graphics
Graphics Processor 2: NVIDIA GeForce RTX 4060 Laptop GPU
Manufacturer: TUXEDO
Product Name: TUXEDO Gemini Gen2

ADDITIONAL INFORMATION

Structural navigation currently only works with the gtk3 version of LibreOffice, not (yet) with the qt6/kf6 one, i.e. only if "Help" -> "About LibreOffice" contains "gtk3" in the version information.

LibreOffice version:

Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 32; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Debian package version: 4:25.2.3-2
Calc: threaded
Comment 1 Bug Janitor Service 2025-07-07 11:39:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7882
Comment 2 Vlad Zahorodnii 2025-07-07 14:48:34 UTC
Git commit 889ffed2bbb40c44dbb8ef4268e5e0bbcb7671da by Vlad Zahorodnii, on behalf of Michael Weghorn.
Committed on 07/07/2025 at 14:11.
Pushed by vladz into branch 'master'.

A11yKeyboardMonitor: Distinguish modifier and other key

When processing a key event, only update
A11yKeyboardMonitor::lastModifier and
A11yKeyboardMonitor::lastModifierTime if
the pressed key is actually a modifier.

Otherwise, the "if the modifier was pressed twice within the
key repeat delay process it normally" logic above would
trigger when pressing a non-modifier key twice within
the key repeat delay time, breaking e.g. Orca's structural
navigation when pressing "H" twice to jump to the heading
after the next, and instead result in a literal "h" getting
inserted when input is accepted (e.g. in an editable
LibreOffice Writer document).

M  +3    -3    src/a11ykeyboardmonitor.cpp

https://invent.kde.org/plasma/kwin/-/commit/889ffed2bbb40c44dbb8ef4268e5e0bbcb7671da
Comment 3 Vlad Zahorodnii 2025-07-07 15:33:53 UTC
Git commit 6b2a1b5bbfa73b59b135acdfee9862f3c991e556 by Vlad Zahorodnii.
Committed on 07/07/2025 at 15:06.
Pushed by vladz into branch 'Plasma/6.4'.

A11yKeyboardMonitor: Distinguish modifier and other key

When processing a key event, only update
A11yKeyboardMonitor::lastModifier and
A11yKeyboardMonitor::lastModifierTime if
the pressed key is actually a modifier.

Otherwise, the "if the modifier was pressed twice within the
key repeat delay process it normally" logic above would
trigger when pressing a non-modifier key twice within
the key repeat delay time, breaking e.g. Orca's structural
navigation when pressing "H" twice to jump to the heading
after the next, and instead result in a literal "h" getting
inserted when input is accepted (e.g. in an editable
LibreOffice Writer document).


(cherry picked from commit 889ffed2bbb40c44dbb8ef4268e5e0bbcb7671da)

Co-authored-by: Michael Weghorn <m.weghorn@posteo.de>

M  +3    -3    src/a11ykeyboardmonitor.cpp

https://invent.kde.org/plasma/kwin/-/commit/6b2a1b5bbfa73b59b135acdfee9862f3c991e556