Bug 146326 - The Autofilter Input Box should get focus upon mouse-hover
Summary: The Autofilter Input Box should get focus upon mouse-hover
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.0.0 beta1+
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:24.8.0
Keywords: bibisected, bisected, regression
: 147439 (view as bug list)
Depends on:
Blocks: AutoFilter
  Show dependency treegraph
 
Reported: 2021-12-20 08:11 UTC by Kevin Suo
Modified: 2024-07-11 18:11 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Video showing the remaining problem (169.05 KB, video/mp4)
2024-05-16 18:33 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2021-12-20 08:11:52 UTC
Steps to Reproduce:

1. Click on any autofilter dropdown.

--> The focus is within the input box, that's good, we can now type in any text for quick search.

2. Move your mouse from the top entry (i.e. Sorting") down through the Filter by Color, then further down to the text Input Box.

--> When mouse hover any other entry, that entry is focused (and if that entry has sub-entries then the sub-entries are popped up). This is good. 

--> However, when mouse hover on top of the text Input Box, the input box does not get focus, thus if you want to type anything into the text box then you need an extra click. This is annoying.

Expected Result:
In step 2, when mouse hover to the text input box, the text input box should get focus to allow quick input of text.

Addition Info:
Actually, at the time when the input box has not get focus, you actually can type, but the typing is not in the input box. It is in a "new" input box, and after you hit ENTER nothing take effect.

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 64589ddc911ed7bcc334adecd46b472adfec15f2
CPU threads: 8; OS: Linux 5.14; UI render: default; VCL: gtk3
Locale: zh-CN (zh_CN.UTF-8); UI: zh-CN
Build Platform: Fedora34@X64, Branch:master, bibisect-linux-64-7.4-CN
Calc: threaded

and also in

Version: 7.3.0.0.beta1+ / LibreOffice Community
Build ID: c25067e46d7d849a584295de365e32c6c7af11bf
CPU threads: 8; OS: Linux 5.14; UI render: default; VCL: gtk3
Locale: zh-CN (zh_CN.UTF-8); UI: zh-CN
Calc: threaded
Comment 1 Kevin Suo 2021-12-20 08:22:41 UTC
Regression caused by the (great) improvements of hover-style autofitler submenus by Caolán in:

commit 29145df0977baa866e7da94d1d385b772ae1e6ce
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Mon Nov 29 12:55:38 2021 +0000

    Resolves: tdf#144811 use the hover-style menu for color submenus

Caolán could you please take a look? Thanks.
Comment 2 raal 2022-01-08 06:28:19 UTC
I can confirm with Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: eee703970581545b56f3b2faa5b5911923ec28ea
CPU threads: 4; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded Jumbo
Comment 3 Kevin Suo 2022-03-01 11:41:21 UTC
*** Bug 147439 has been marked as a duplicate of this bug. ***
Comment 4 Rafael Lima 2022-03-01 14:19:13 UTC Comment hidden (obsolete, wrong)
Comment 5 Rafael Lima 2022-03-01 14:21:09 UTC
The following attachments from duplicate bug 147439 may help clarify what is happening since 7.3.

Attachment 178282 [details] shows what happens since 7.3, with the input box losing focus when it hovers over an entry with sub-entries.

Attachment 178283 [details] is a short video showing what happens in 7.2.5 (which is the correct behavior). The input box does not lose focus when the mouse hovers over the dialog.
Comment 6 Aron Budea 2023-12-10 06:04:37 UTC
Another symptom:
When opening Filter by Condition -> Standard Filter..., the focus is initially in the dialog, but is lost almost immediately. This is a regression from the same commit.
Comment 7 Caolán McNamara 2023-12-21 15:31:19 UTC
presumably the keyboard focus is initially in the GtkEntry, and when a submenu appears the keyboard focus is set there, so when the submenu pops down the focus is returned to the GtkTreeView parent of the submenu.

Maybe we could check on the submenu popup where the keyboard focus is and return it to the GtkEntry if that's where it was before hand (for the common use case at least)
Comment 8 Commit Notification 2024-05-14 15:35:19 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a525895a5f820350dc307969b1e8fd5d218a1ddd

Resolves: tdf#146326 restore focus on autofilter submenu popdown

It will be available in 24.8.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 9 Rafael Lima 2024-05-16 18:33:47 UTC
Created attachment 194155 [details]
Video showing the remaining problem

Thanks @Caolan for the patch, but it does not fix the case reported in bug 147439 (marked as duplicate of this one).

If you open the AutoFilter and simply move the mouse down, the focus will not return to the GtkEntry.

See attached video showing what I mean.

Tested with:

Version: 24.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: f1c91993e54858f9bc7ed78d25485a09157c04be
CPU threads: 16; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: CL threaded
Comment 10 Caolán McNamara 2024-05-17 20:09:12 UTC
ah I see, in the other case the "submenu" doesn't appear but we always "cancel" the menu appearing and that triggers restoring the focus, but the place to restore the focus to happens on a real launch of the submenu so it still gets restored back the menu and not the widget with initial focus.

https://gerrit.libreoffice.org/c/core/+/167798 should make this particular scenario work.
Comment 11 Commit Notification 2024-05-18 12:03:21 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b2dc515e2a3c8420c7f39c0b4396632c2086126a

Related: tdf#146326 restore correct focus when on submenu launched

It will be available in 24.8.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 12 Rafael Lima 2024-07-11 18:11:24 UTC
Thanks Caolan! It's working as expected in master.