feat: add support for slotted list-box to context-menu - #12172
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 4 comments.
| Finding | |
|---|---|
A slotted list-box menu is left unclosable when items is set before slotchange runs. |
|
Removing a slotted list-box throws an uncaught error when both items and renderer are set. |
|
__preserveMenuState reads listBox.items.indexOf without guarding against undefined items. |
|
| 🧹 | New _menuListBox getter duplicates the list-box resolution already in __getListBox(). |
- Reject the items + renderer combination synchronously in _contentSourceChanged so removing a slotted list-box no longer surfaces a deferred throw from the async slotchange handler. - Restore the default closeOn when the items branch cleared it before the slotted list-box was detected, so clicking an item closes the menu. - Guard __preserveMenuState against a slotted list-box whose items are not yet initialized. - Consolidate list-box resolution into a single _menuListBox getter on ItemsMixin (replacing __getListBox); the first-child fallback for custom renderer content is inlined at the two call sites that need it. Part of #11422 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vursen
reviewed
Jul 20, 2026
vursen
reviewed
Jul 20, 2026
Combining a slotted <vaadin-context-menu-list-box> with the items or renderer API is not a supported use case, so it now throws instead of warning. With the three content sources mutually exclusive, the closeOn handling collapses to a single default-clearing branch. Part of #11422 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vursen
reviewed
Jul 20, 2026
Move the mutual-exclusion check for items, renderer, and a slotted list-box out of a complex observer into the updated() lifecycle, matching the approach used in vaadin-select. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vursen
reviewed
Jul 20, 2026
vursen
reviewed
Jul 20, 2026
vursen
reviewed
Jul 20, 2026
vursen
approved these changes
Jul 20, 2026
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Same as #12131 but for
vaadin-context-menu.Type of change