Bug 156376 - Pressing F1 while hovering a menu entry does not work in gtk3 or kf5
Summary: Pressing F1 while hovering a menu entry does not work in gtk3 or kf5
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0
Keywords: accessibility, implementationError
Depends on:
Blocks: Shortcuts-Accelerators KDE, KF5 GTK3 Help
  Show dependency treegraph
 
Reported: 2023-07-19 12:04 UTC by Rafael Lima
Modified: 2023-08-02 09:58 UTC (History)
3 users (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 Rafael Lima 2023-07-19 12:04:33 UTC
On Windows, if you hover over a menu entry (f.i. Tools - Spelling) and then press F1 while the mouse is over the entry, the corresponding help page will open.

This also works with "gen" on Linux... I can't tell about MacOS.

However it does not with with gtk3 or kf5.

I believe it should work in all backends. Is this fixable in gtk3 and kf5?

System info

Version: 7.5.4.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 4:7.5.4-0ubuntu0.23.04.1
Calc: threaded
Comment 1 Stéphane Guillou (stragu) 2023-07-19 13:15:08 UTC
Marking as an accessibility issue as some users rely on keyboard navigation.

Confirmed in:

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

and

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

Used to work in:

Version: 6.1.0.3
Build ID: efb621ed25068d70781dc026f7e9c5187a4decd1
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk2; 
Locale: en-AU (en_AU.UTF-8); Calc: group threaded

It started with the use of gtk3 over gtk2.

For kf5 VCL, it is only usable since 6.4, and F1 on menu items never worked.
Comment 2 Michael Weghorn 2023-07-20 05:02:59 UTC
(In reply to Rafael Lima from comment #0)
> I believe it should work in all backends. Is this fixable in gtk3 and kf5?

gtk3 and kf5 are using native Gtk/Qt menus, so making this work might require hooking into their key event handling, but should probably be doable.
Comment 3 Rafael Lima 2023-07-27 12:35:25 UTC
(In reply to Michael Weghorn from comment #2)
> gtk3 and kf5 are using native Gtk/Qt menus, so making this work might
> require hooking into their key event handling, but should probably be doable.

Michael, do you have any code pointer about this in kf5? I could give it a try.
Comment 4 Michael Weghorn 2023-07-27 13:44:59 UTC
(In reply to Rafael Lima from comment #3)
> (In reply to Michael Weghorn from comment #2)
> > gtk3 and kf5 are using native Gtk/Qt menus, so making this work might
> > require hooking into their key event handling, but should probably be doable.
> 
> Michael, do you have any code pointer about this in kf5? I could give it a
> try.
Thanks! I had quickly experimented with this a bit, can try to find some time this weekend to either turn it into an actual patch or something that at least gives some input on how to hook into the event handling. (Code for the kf5 menu is in vcl/qt5/QtMenu.cxx .)
Comment 5 Michael Weghorn 2023-07-30 00:08:39 UTC
(In reply to Michael Weghorn from comment #4)
> Thanks! I had quickly experimented with this a bit, can try to find some
> time this weekend to either turn it into an actual patch or something that
> at least gives some input on how to hook into the event handling. (Code for
> the kf5 menu is in vcl/qt5/QtMenu.cxx .)

-> https://gerrit.libreoffice.org/c/core/+/155055 for the Qt-based VCL plugins
Comment 6 Commit Notification 2023-08-01 06:21:39 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2ef9880f97de6629ddef12eb788123ab4be1ec83

tdf#156376 qt: Open help for focused native menu entry on F1

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Michael Weghorn 2023-08-01 06:25:02 UTC
(In reply to Rafael Lima from comment #0)
> However it does not with with gtk3 or kf5.

kf5 works now with the commit from comment 6 in place, gtk3 still doesn't.
Comment 8 Rafael Lima 2023-08-01 20:04:09 UTC
(In reply to Michael Weghorn from comment #7)
> (In reply to Rafael Lima from comment #0)
> kf5 works now with the commit from comment 6 in place, gtk3 still doesn't.

Do you plan to fix this in gtk3 as well? If not, we could CC someone else.
Comment 9 Michael Weghorn 2023-08-01 21:27:36 UTC
(In reply to Rafael Lima from comment #8)
> Do you plan to fix this in gtk3 as well? If not, we could CC someone else.
No, I don't have any such plans at the moment, and my gtk experience is also much more limited.
Comment 10 Stéphane Guillou (stragu) 2023-08-02 09:10:59 UTC
Caolán, any insights on using F1 on menus with gtk3?

Same with:

Version: 6.0.0.0.alpha1+
Build ID: 6eeac3539ea4cac32d126c5e24141f262eb5a4d9
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3; 
Locale: en-AU (en_AU.UTF-8); Calc: group threaded
Comment 11 Caolán McNamara 2023-08-02 09:58:17 UTC
I can't comment on the kf5 menus, but there are two types of menus in gtk, the various arbitrary menus like context menus and then the other types of menus which belong to the toplevel menubar. For the toplevel menubar we provide an fairly abstract menumodel to gtk. https://docs.gtk.org/gio/class.MenuModel.html and https://developer-old.gnome.org/gio/stable/GMenuModel.html 

As far as I know there is no field/support in that MenuModel which supports the concept of help for a menu entry and no straightforward way to access the underlying widgets that implement the menu in order to hook into some F1/help activation (the menubar and menus might not even be in the application, the Unity thing of a macOS-like shared desktop menubar might have fallen out of favor but the apis we use are theoretically supportive of that so the menumodel might not even get consumed by a traditional menubar+menu.

I could see that hacking the arbitrary menus might be doable to get help in there, but I never could see how to do it for the toplevel menubar+menus.