Bug 156457 - Keep relevant accelerators visible when submenu auto-expands (GTK3 + Wayland)
Summary: Keep relevant accelerators visible when submenu auto-expands (GTK3 + Wayland)
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: x86-64 (AMD64) Linux (All)
: low minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: accessibility
Depends on:
Blocks: Shortcuts-Accelerators Wayland GTK3
  Show dependency treegraph
 
Reported: 2023-07-24 22:12 UTC by Stéphane Guillou (stragu)
Modified: 2023-07-25 11:50 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Guillou (stragu) 2023-07-24 22:12:11 UTC
When navigating with the keyboard to a submenu, the accelerator characters are not underlined even though they are available to use.

Example steps:
1. Open Writer.
2. Click on Tools, move pointer to "Protect Document": as expected, no accelerators shown in either the menu or the submenu.
3. Press "Alt + T" to expand the Tools menu, then "P" to expand the submenu: as expected, accelerators shown in the menu and the submenu only when they are active/relevant.
4. Click on Tools menu, then press Down arrow once: accelerators shown (in my opinion, expected because the user is using the keyboard to navigate)
5. Down arrow to the "Protect Document" submenu

Actual results:
No accelerators shown in either the Tools menu nor the Protect Document submenu, even though they still apply to the Tools menu.
This can be tested by pressing "B": it opens the ~Bibliography Database, not Protect ~Bookmarks.

Expected results:
Tools menu accelerators remain visible.

This is also true for context menus.

This is reproduced in a recent master build, and since GTK3 was made the default VCL over GTK2, in 6.2. (Before, accelerators were visible in the two menus, so can't really be called a regression.)

Version: 6.2.0.3
Build ID: 98c6a8a1c6c7b144ce3cc729e34964b47ce25d62
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3; 
Locale: en-AU (en_AU.UTF-8); UI-Language: en-US
Calc: threaded

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 94caaf5c9e2917a3202cf515d61eaa9399b2c2b5
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

(Note about other VCLs: gen and kf5 VCLs, need to Right-arrow or press Enter to expand the submenu. Accelerators always shown.)
Comment 1 Caolán McNamara 2023-07-25 08:12:57 UTC
"5. Down arrow to the "Protect Document" submenu

Actual results:
No accelerators shown in either the Tools menu nor the Protect Document submenu, even though they still apply to the Tools menu.
This can be tested by pressing "B": it opens the ~Bibliography Database, not Protect ~Bookmarks."

This isn't under our control, its what the underlying toolkit does. (Though FWIW if you press right arrow to enter the submenu then they the underlines are shown, which is similar to when pressing 'P' which autoselects the first entry of the submenu)

You can see the same effect in gtk3-demo, and launch the "Application Class" example (first one in list) that has a menubar where pressing alt+p activates its menu and cursoring down to "Color" also results in the old menu and new submenu lacking underlines.

I can't see an exact match on searching https://gitlab.gnome.org/GNOME/gtk/-/issues/ and the gtk4-demo experience seems even worse at the moment.
Comment 2 Michael Weghorn 2023-07-25 08:24:02 UTC
Caolán has already written pretty much the same while I was typing, but adding my original text here anyway, since the behavior I see is slightly different from what Stéphane describes:

(In reply to Stéphane Guillou (stragu) from comment #0)
> 4. Click on Tools menu, then press Down arrow once: accelerators shown (in
> my opinion, expected because the user is using the keyboard to navigate)
> 5. Down arrow to the "Protect Document" submenu
> 
> Actual results:
> No accelerators shown in either the Tools menu nor the Protect Document
> submenu, even though they still apply to the Tools menu.

For me (Debian testing, libgtk-3-0:amd64 3.24.37-2), the accelerators for the Tools menu are still shown at this point, but not those of the "Protect Document" submenu. When I right-arrow into the submenu, the accelerators of the submenu are shown, but no more those of the Tools submenu. This might be intended.

Since gtk3 uses native gtk menus, this behavior seems to come from the Gtk library, so I tend to think this is NOTOURBUG.

Gedit behaves the same for me:

1) start gedit
2) type some text, e.g. "werwerwer"
3) select the text
4) right-click on the text
   -> context menu shows up, without accelerators
5) press Down arrow once: accelerators shown
6) arrow-down to the "Change Case" entry

For me, like for the LO case, the accelerators are still shown for the "top-level" entries, not the submenu. Once I click right-arrow, focus moves into the submenu and accelerators are shown for entries there.

What's your Gtk version? Does another Gtk application, e.g. Gedit, behave the same?

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 81994cb2b8b32453a92bcb011830fcb884f22ff3
CPU threads: 12; OS: Linux 6.3; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded
Comment 3 Stéphane Guillou (stragu) 2023-07-25 11:50:33 UTC
Thank you both for looking into it!

(In reply to Michael Weghorn from comment #2)
> What's your Gtk version? Does another Gtk application, e.g. Gedit, behave
> the same?

Ubuntu 20.04 with GNOME 3.36.8 and libgtk 3.24.20-0ubuntu1.1.

Gedit behaves the same as LO for me, as in my Description: no accelerators on either side when submenu pops up. However, I just figured out that it is Wayland-related: with an x11 window, I get the same results as you.

Looking at https://metadata.ftp-master.debian.org/changelogs//main/g/gtk+3.0/gtk+3.0_3.24.37-2_changelog , I'm wondering if this is already fixed since 3.24.28 with:

>  - Wayland: Fix matching of accelerators with multiple layouts

In any case, confirming it's not our bug. I thought we had more control over it, sorry for the noise!