Description
Describe your motivation
Currently calling ContextMenu.requestContentUpdate
has no effect when just using the items
API together with the default renderer. This makes it less useful as it could be.
A use-case for this came up in #5389, where the user wants to update the items of a context menu while it is opened. Making requestContentUpdate
work with the items
API would allow to change the items
property and then call requestContentUpdate
to re-render the overlay.
Describe the solution you'd like
We should consider removing the check for a custom renderer from requestContentUpdate
, so that it is also run when using the default renderer.
One caveat to look out for is when using a hierarchical context menu. Are nested opened menus going to be updated as well? If this is not trivial to implement we could still consider documenting this as a limitation.
Describe alternatives you've considered
Make items
property reactive, so that just changing the property triggers a content update even while the overlay is opened. This seems to be the most convenient way to update an opened context menu, but might have other caveats.
requestContentUpdate
works when using a custom context menu renderer, however rebuilding the default renderer is not trivial (a11y attributes, disabled, checked states, etc.).
Additional context
No response