Bug 472391

Summary: Search box's focus/unfocus animation is distracting during widget popup animation
Product: [Frameworks and Libraries] libplasma Reporter: Jin Liu <ad.liu.jin>
Component: componentsAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: dev+kde, me, nate, notmart
Priority: NOR    
Version First Reported In: 5.108.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.0
Sentry Crash Report:
Attachments: Screencast: networkmanager
Screencast: discover

Description Jin Liu 2023-07-19 10:06:39 UTC
Created attachment 160387 [details]
Screencast: networkmanager

SUMMARY
When popping up a widget that has a search box focused by default (e.g. NetworkManager), the search box plays an animation (hiding the search icon) at the same time the widget popup animation is playing, which is a little distracting. And because the animation is not caused by the user explicitly interacting with the search box, its meaning is unclear to the user.

Some applications (e.g. Discover) also have this problem.

STEPS TO REPRODUCE
1. Click on the NetworkManager tray icon.
2. Watch the search box animation during widget popup.

OBSERVED RESULT
Search box plays a "search icon hiding" animation.

EXPECTED RESULT
Search box plays no animation.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Comment 1 Jin Liu 2023-07-19 10:07:26 UTC
Created attachment 160388 [details]
Screencast: discover
Comment 2 ratijas 2023-07-19 10:16:58 UTC
   Not fixable without "proper" view lifecycle management, like iOS and
   Android does. Previous attempts to disable the animation failed, as
   they were incomplete and relying on non-deterministic order of events.
   This is sort of a result of QML's simplicity, which also its curse
   when it comes to advanced granular control over details like this.
Comment 3 Jin Liu 2023-07-19 10:23:36 UTC
Can we just remove this animation?
1. It's not a popular design. Search boxes in most web browsers and websites don't hide the search icon when focused. The search box at the top of this bug report doesn't hide the icon, either.
2. When the user entered some text in the search box, and the icon is hidden, the search box has no indication of its function at all. This is very unusual UI design.
3. Search boxes in KDE are generally wide enough that hiding the icon doesn't add much.
Comment 4 ratijas 2023-07-19 10:32:39 UTC
   I can't disagree. But that's not something I implemented. And the
   community reaction was like, "wow, exciting, cool", so removing it
   would most certainly annoy some people.
   You could try submitting an MR for PlasmaExtras/SearchTextField, and
   see how it goes.
Comment 5 Jin Liu 2023-07-19 10:51:22 UTC
(In reply to ratijas from comment #4)
>    You could try submitting an MR for PlasmaExtras/SearchTextField, and
>    see how it goes.

OK. I guess you mean these two?

https://invent.kde.org/frameworks/kirigami/-/blob/master/src/controls/SearchField.qml
https://invent.kde.org/frameworks/plasma-framework/-/blob/master/src/declarativeimports/plasmaextracomponents/qml/SearchField.qml
Comment 6 Bug Janitor Service 2023-07-20 03:20:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/829
Comment 7 Bug Janitor Service 2023-07-25 01:58:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1184
Comment 8 Nate Graham 2023-07-25 16:12:12 UTC
*** Bug 470471 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2023-07-25 16:15:19 UTC
Git commit ee888dec9c486160dde16156f746ee801e2cbaf1 by Nate Graham, on behalf of Jin Liu.
Committed on 25/07/2023 at 18:13.
Pushed by ngraham into branch 'master'.

Remove the animation of the search icon in SearchField

Always show the search icon regardless if the search box is focused or not.

Rationale:
1. The current design (hide the search icon when focused) is unusual. Web
   browsers (e.g. Firefox, Chrome, Edge) and websites (e.g. Google, Gitlab)
   normally always show the search icon in the search box, so the user
   probably is expecting that.
2. Search boxes in Plasma and KDE apps are generally wide enough, that hiding
   one icon doesn't add much to it.
3. The animation is triggered during a tray icon (e.g. NetworkManager) poping
   up or an app (e.g. Discover) launching. The user doesn't interact with the
   search box at that time, so the animation can be confusing/distracting. And
   according to dev (https://bugs.kde.org/show_bug.cgi?id=472391) this can be
   hard to fix.

M  +1    -9    src/declarativeimports/plasmaextracomponents/qml/SearchField.qml

https://invent.kde.org/frameworks/plasma-framework/-/commit/ee888dec9c486160dde16156f746ee801e2cbaf1
Comment 10 Nate Graham 2023-07-25 16:15:21 UTC
Git commit c4c84605c94cb3676a7902a484513d3b0188819b by Nate Graham, on behalf of Jin Liu.
Committed on 25/07/2023 at 18:15.
Pushed by ngraham into branch 'master'.

Remove the animation of the search icon in SearchField

(please keep the discussion in https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/829)

Always show the search icon regardless if the search box is focused or not.

Rationale:

1. The current design (hide the search icon when focused) is unusual. Web browsers (e.g. Firefox, Chrome, Edge) and websites (e.g. Google, Gitlab) normally always show the search icon in the search box, so the user probably is expecting that.
1. Search boxes in Plasma and KDE apps are generally wide enough, that hiding one icon doesn't add much to it.
1. The animation is triggered during a tray icon (e.g. NetworkManager) poping up or an app (e.g. Discover) launching. The user doesn't interact with the search box at that time, so the animation can be confusing/distracting. And according to dev (https://bugs.kde.org/show_bug.cgi?id=472391) this can be hard to fix.

M  +2    -10   src/controls/SearchField.qml

https://invent.kde.org/frameworks/kirigami/-/commit/c4c84605c94cb3676a7902a484513d3b0188819b