UI5 / UI5/openui5

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
#3,941 8 comments 0 reactions 2 assignees View on GitHub

@Todor-ads is already working on this.

Since Sep 5, 2025.

bug in progress
Dominant language
JavaScript
Stars
3.3k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.