Bug 144490

Summary: Context menu subentry Wrap should be disabled, if no options available
Product: LibreOffice Reporter: Buovjaga <ilmari.lauhakangas>
Component: UIAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WONTFIX    
Severity: enhancement CC: 79045_79045, andreas.heinisch
Priority: lowest    
Version: 6.3.0.4 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 86349    

Description Buovjaga 2021-09-14 13:18:18 UTC
1. Open Writer
2. Insert Frame
3. Right-click the inserted frame - Anchor - As Character
4. Right-click again, see Wrap menu item

It should be greyed out.

Currently it displays one entry [No selection possible] with gen, gtk3, Windows. With kf5, it doesn't open the submenu at all.
Comment 1 Roman Kuznetsov 2021-09-15 21:52:23 UTC
Confirm in current 7.3

I think it's an enhancement. The item Wrap shouldn't be in Context menu in that case at all
Comment 2 Andreas Heinisch 2022-07-02 16:29:31 UTC
Should be easy, but I don't know how to disable the main menu:

Insertion of the new submenu:
https://opengrok.libreoffice.org/xref/core/vcl/source/window/menu.cxx?r=fb9af884#2845

Start of the popup menu:
https://opengrok.libreoffice.org/xref/core/vcl/source/window/menu.cxx?r=fb9af884#2940

Any call to any function doesn't seem to do anything :(
Comment 3 Mike Kaganski 2022-07-04 07:52:43 UTC
(In reply to Buovjaga from comment #0)
> It should be greyed out.

My take: WF.
The current implementation of (sub)menus in LibreOffice is that we do *not* enumerate sub-items when creating menus, and *only* count/create submenus at the moment the user wants to expand it. This helps performance (user does not need to wait for all submenus parsed before the main menu shows), and also simplifies implementation, where both static and dynamic submenus are handled uniformly.

This proposal requires that when the main context menu is shown, multiple operations be performed to count submenus, and based on that, some menus be disabled (or hidden, as comment 1 suggests). The imagined benefit IMO is not worth it. I do not see the current status making user experience any worse. (For any option, there could be proponents - e.g., Roman suggests hiding it, but there is a PoV that it's better to never hide, to make the positions of elements fixed and a feedback present that "an action is possible, but not right now" - as Noel mentioned on the IRC).