sap.m.Menu is not displayed correctly when using as context menu for sap.m.ListBase and with aggregation binding - subitems are not displayed
@Todor-ads is already working on this.
Since Sep 5, 2025.
- 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):
This is how the context menu is displayed with UI5 version 1.120:
Kind regards
Julia
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.