Dynamic contextmenu items cause null exception in ContextMenu.positionSubmenu #11173
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted.
Here is stackblitz with 13 and failing:
https://stackblitz.com/edit/angular-ivy-fa7of2?file=src/app/app.component.html
Here is stackblitz with 10 and working (please ignore url naming):
https://stackblitz.com/edit/angular-10-directive-elementref-example-ws5lg4?file=src/app/app.component.ts
Current behavior
Dynamically add items to bound MenuItem[] then use ContextMenu.show(). First time you are able to select the dynamically added menu item. The dynamically added item is removed in the onHide() event. The second time you right click the dynamic item is added again but a null exception occurs. This was working fine with Primeng 9 and 10. When updating to 11 the bug was introduced, and exists in 13.
Expected behavior
Not throw null reference exception.
Minimal reproduction of the problem with instructions
See above.
Please tell us about your environment:
Windows 10
Bug first appears with Angular 11, but present in 12 and 13.
Bug first appeared with Primeng 11, present in 12 and 13.
Only tested with Chrome Version 98.0.4758.82 on Windows
Language: [all | TypeScript X.X | ES6/7 | ES5]
Node (for AoT issues):
node --version
=With or without IVY.
The text was updated successfully, but these errors were encountered: