openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

sap.m.Menu is not displayed correctly when using as context menu for sap.m.ListBase and with aggregation binding - subitems are not displayed

Open uifivvy opened this issue 2 years ago • 8 comments

OpenUI5 version: 1.120

Browser/version (+device/version): Chrome (120), Windows 10

URL (minimal example if possible): The context menu for a sap.m.ListBase is not displayed correctly if menu items have subitems. The Problem may be the attached event handler for the aggregationChanged event of the Menu.js: https://github.com/SAP/openui5/blob/6242712774b66c65a9068ea1da85c56185f2040a/src/sap.m/src/sap/m/Menu.js#L173

Steps to reproduce the problem:

  • Create a context menu with aggregation binding using items with and without subitems
  • Add the context menu to a sap.m.ListBase (I used the sap.m.Table)
  • Open the context menu, all items, including items with submenus, should be displayed

What happens instead? The items with no subitems are displayed, but items with submenus are not visible

Any other information? (attach screenshot if possible) I think it has to do with the attached event handler which hasn't been done before UI5 version 1.120. Therefore, the function _addOrInsertItem is now called when the context menu aggregation binding has been changed, and I think the problem may be that the parent item is not rendered yet, so the function oParentItem._getVisualControl() in line 928 returns undefined.

This is how the context menu should be displayed (works with UI5 version 1.108): image

This is how the context menu is displayed with UI5 version 1.120: image

Kind regards Julia

uifivvy avatar Jan 08 '24 11:01 uifivvy

Could you share a link to a minimal sample? E.g. from one of these templates (edit, save/fork, and share the new URL):

  • JSBin: https://jsbin.com/neyagus/edit?html,js,output
  • Plunker: https://plnkr.co/edit/16J1TFICxbqETCzaxuZ0

boghyon avatar Jan 08 '24 14:01 boghyon

@boghyon Yes sure, I've created an example in JSBin:

https://jsbin.com/mojulazeya/edit?html,js,output

The first list has a static context menu, the second list has changing menu items. In the second list the "Item 2" with a submenu should be displayed, but it's not. Also the following items, which don't have submenus, aren't displayed.

If you change the UI5 version to e.g. 1.108, it works just fine.

uifivvy avatar Jan 08 '24 15:01 uifivvy

Thanks for sharing, I can see that the issue is reproducible since https://github.com/SAP/openui5/commit/ec6065e0e0fb2bfbd44dc0d7357abaa07716d4f8 (UI5 1.113).

boghyon avatar Jan 08 '24 16:01 boghyon

Hello @uifivvy, Thank you for sharing this finding. I've created an internal incident DINC0033815. The status of the issue will be updated here in GitHub.

50gY avatar Jan 08 '24 16:01 50gY