Bug 446990

Summary: Wayland: Tooltip on date input fields steals focus, prevents entering data
Product: [Applications] kmymoney Reporter: Marco Rebhan <me>
Component: ux-uiAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: auxsvr, jvlawrence01, p.r.worrall
Priority: NOR    
Version: 5.1.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.3
Sentry Crash Report:

Description Marco Rebhan 2021-12-14 19:51:47 UTC
SUMMARY
Every time a date input field is selected, a tooltip with the date in it is opened and very quickly closed in succession, which makes it impossible to enter data because the focus switches constantly. The only way to reliably enter dates is through the calendar date picker.

There's a workaround (kind of): setting the window activation policy in System Settings to "Focus under mouse". This causes the tooltip to not steal the focus on the window so dates can be entered normally. However, this obviously affects how the focus works for the entire desktop so not really a good option.

This is probably related to how tooltips work in Wayland (needing a parent to be treated as a proper tooltip instead of a standalone window), e.g. see bug 442779.

STEPS TO REPRODUCE
1. Focus a date field (e.g. in Ledgers)

OBSERVED RESULT
While the date field is focused, a tooltip is opened which takes away focus from the main window, due to the main window losing focus the tooltip disappears, then the date field is focused again, showing the tooltip again, etc. in an infinite loop.

EXPECTED RESULT
The tooltip shouldn't show in the first place, or it shouldn't be opened in such a way that it has its own focus separate from the main window.

SOFTWARE/OS VERSIONS
Operating System: Gentoo 2.8
KDE Plasma Version: 5.23.80
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.2
Kernel Version: 5.14.21-gentoo-dist (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 23.4 GiB of RAM
Graphics Processor: AMD Radeon RX Vega

ADDITIONAL INFORMATION
Comment 1 Jack 2021-12-14 20:11:06 UTC
If, as I suspect, this is specific to Wayland, then I would clarify that in they subject, and would guess that there is nothing the KMyMoney team can directly do about it.  Unfortunately, I'm not sure which component to report this against - possibly frameworks-kwayland, frameworks-plasma, or one of the other plasma components.
Comment 2 Marco Rebhan 2021-12-14 21:26:50 UTC
(In reply to Jack from comment #1)
> If, as I suspect, this is specific to Wayland, then I would clarify that in
> they subject, and would guess that there is nothing the KMyMoney team can
> directly do about it.  Unfortunately, I'm not sure which component to report
> this against - possibly frameworks-kwayland, frameworks-plasma, or one of
> the other plasma components.

Looking at the code for a bit, this might technically be a Frameworks bug. However, KMyMoney uses [1] the deprecated KPassivePopup component [2] for this so it should probably be ported away from that either way, and since it's deprecated I don't assume that component will be fixed to work correctly on Wayland, also it seems to me like doing that would need it to be rewritten significantly since it uses a lot of absolute positioning logic for one.

Going to unlink bug 442779 since there's more going on than just that, if it's even related.

[1]: https://invent.kde.org/office/kmymoney/-/blob/master/kmymoney/widgets/kmymoneydateinput.cpp
[2]: https://invent.kde.org/frameworks/knotifications/-/commit/3b972140996edcf83e2d311409b5ee6745cc902e
Comment 3 Jack 2022-01-01 01:07:41 UTC
*** Bug 439289 has been marked as a duplicate of this bug. ***
Comment 4 Bug Janitor Service 2022-01-01 22:40:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/kmymoney/-/merge_requests/141
Comment 5 Bug Janitor Service 2022-01-01 22:40:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/kmymoney/-/merge_requests/141
Comment 6 Thomas Baumgart 2022-01-06 09:37:14 UTC
Git commit fce954bd1648ef1d1588b8ae753421be9c7a5fec by Thomas Baumgart, on behalf of Marco Rebhan.
Committed on 06/01/2022 at 08:38.
Pushed by tbaumgart into branch 'master'.

Remove use of deprecated KPassivePopup

Removed completely because the popup displayed the same date as displayed
in the date field itself, making it unneeded imo. This fixes the popup rapidly
appearing and disappearing on Wayland when the date field has focus, making
it very hard to input a date.

M  +1    -27   kmymoney/widgets/kmymoneydateinput.cpp

https://invent.kde.org/office/kmymoney/commit/fce954bd1648ef1d1588b8ae753421be9c7a5fec
Comment 7 Thomas Baumgart 2022-01-06 11:36:35 UTC
Git commit 6739583967a2c1e9a7f3d4c5aa1503cb08d0cb46 by Thomas Baumgart.
Committed on 06/01/2022 at 11:22.
Pushed by tbaumgart into branch '5.1'.

Remove use of deprecated KPassivePopup

Removed completely because the popup displayed the same date as
displayed in the date field itself, making it unneeded imo. This fixes
the popup rapidly appearing and disappearing on Wayland when the date
field has focus, making it very hard to input a date.
FIXED-IN: 5.1.3

(cherry picked from commit fce954bd1648ef1d1588b8ae753421be9c7a5fec)

M  +1    -27   kmymoney/widgets/kmymoneydateinput.cpp

https://invent.kde.org/office/kmymoney/commit/6739583967a2c1e9a7f3d4c5aa1503cb08d0cb46
Comment 8 Jack 2022-01-21 23:10:49 UTC
*** Bug 442586 has been marked as a duplicate of this bug. ***