Focus stolen from search bar after several seconds leads to misclicks

Bug #1963868 reported by Ori Avtalion
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

Using calibre 5.38.0, but happens on earlier versions as well.

In the main UI, if you start typing something in the search bar, and hesitate for a few seconds, the search query will "submit" automatically, which will filter the view, and move the focus to the book list.

This has caught me by surprise several times, and caused me to continue typing the search query, when the focus was already on the book list. Since the book list accepts hotkeys without any modifier (e.g., V to view, and maybe more destructive stuff), this can cause various unintended behaviors, such as windows opening and error messages popping up.

Please consider either disabling that auto-search, or keeping it, while making sure the focus stays on the search bar.

Revision history for this message
ownedbycats (ownedbycats) wrote (last edit ):

Preferences -> Search -> Search as you type will disable auto-searching entirely if you'd like, though I agree that having it switch focus automatically is not ideal.

Revision history for this message
Ori Avtalion (salty-horse) wrote :

Thanks for the pointer. Yes, let's make this bug about the stolen focus :)

Ideally, if the focus isn't stolen, there shouldn't be any delay. It should start filtering as soon as I type - unless it's done to avoid cases when search is too slow...???

Revision history for this message
Charles Haley (cbhaley) wrote :

For me, the search bar doesn't lose focus when using search as you type.

1) start calibre.
2) check the preference (I normally leave it off).
3) quit calibre.
4) start calibre.
5) click in the search box.
6) type an 'a'.
7) wait a second. calibre searches for 'a'. The focus remains in the search box.
8) type 'b'.
9) wait a second. calibre searches for 'ab'

My guess is that you have configured a plugin, perhaps action chains or view manager, to do something after a search, and it is this plugin that is moving the focus.

Changed in calibre:
status: New → Invalid
Revision history for this message
Ori Avtalion (salty-horse) wrote :

Charles, can you try it with the Cover Grid on? I think that's the cause. It doesn't happen for me when I turn it off.

Is that considered a "plugin"?

BTW, even when it's off, I still don't understand the reasoning behind the search not being immediate, as soon any change is made to the text box.

Revision history for this message
Ori Avtalion (salty-horse) wrote :

While we're on the topic, the same focus-stealing happens in the plugin list search box :)
I think it should be fixed there as well.

Revision history for this message
Charles Haley (cbhaley) wrote :

Yes, it does happen when using the cover grid. It isn't something I care about so it is up to Kovid to decide what, if anything, to do.

As for the delay, IIRC that was put in because it was unusable with large libraries without it. The keyboard is blocked by the search process.

Changed in calibre:
status: Invalid → New
Revision history for this message
Charles Haley (cbhaley) wrote :

@Kovid: the focus loss seems fixable by adding
in gui2.searchbox.timer_event line 247. I don't know whether adding that line will break anything else.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.