Bug 428631

Summary: Context menu of text field gets hidden underneath OverlaySheet
Product: [Frameworks and Libraries] frameworks-qqc2-desktop-style Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, aleixpol, espidev, justin.zobel, kde, nate, noahadvs
Priority: NOR    
Version: 5.80.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.82
Sentry Crash Report:
Attachments: screenshot

Description Patrick Silva 2020-11-03 08:38:57 UTC
Created attachment 132980 [details]
screenshot

STEPS TO REPRODUCE
1. open Discover
2. click on "Settings" in the sidebar
3. click on "+ Add source..." button
4. right-click on the text field

OBSERVED RESULT
as we can see in the attached screenshot, context menu is partially hidden

EXPECTED RESULT
context menu should be entirely visible

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.20.80
KDE Frameworks Version: 5.76.0
Qt Version: 5.15.0
Comment 1 Justin Zobel 2020-11-04 03:04:46 UTC
Confirmed on KDE Neon Unstable.
Comment 2 Nate Graham 2021-04-07 20:09:30 UTC
This is a problem with the QQC2 context menu we inject into the text field; it should be drawn on top of everything else (including this Kirigami OverlaySheet), but it's not. Naively setting `z: 99999` on it does not seem to work.
Comment 3 Noah Davis 2021-04-07 21:45:16 UTC
(In reply to Nate Graham from comment #2)
> This is a problem with the QQC2 context menu we inject into the text field;
> it should be drawn on top of everything else (including this Kirigami
> OverlaySheet), but it's not. Naively setting `z: 99999` on it does not seem
> to work.

I think I figured out a solution to this, but it's not quite ready yet since the solution I found doesn't currently work without removing the 1,1 position offset added to prevent users from accidentally selecting menu items.
Comment 4 Noah Davis 2021-04-07 21:49:51 UTC
The solution I found is to set Overlay.overlay as the parent, then set the Z value to the highest Z value among all of Overlay.overlay's visibleChildren, plus 1. To get the menu to the correct position, I call popup(target).
Comment 5 Bug Janitor Service 2021-04-07 22:46:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/65
Comment 6 Noah Davis 2021-04-08 21:58:45 UTC
Git commit 0dfaa46fd1815534b7156abf8d120d6813d026bd by Noah Davis.
Committed on 08/04/2021 at 18:00.
Pushed by ndavis into branch 'master'.

Keep context menu above other popups, use dismiss()

Keeps the context menu above other popups by setting its Z value to
the highest Z value among the children of Overlay.overlay, plus 1.

Also using dismiss() instead of close() because dismiss will
completely close a menu. Doesn't really matter here since
there are no submenus, but it's the correct thing to do.
FIXED-IN: 5.82

M  +19   -12   org.kde.desktop/private/TextFieldContextMenu.qml

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/0dfaa46fd1815534b7156abf8d120d6813d026bd