KEMBAR78
refactor!: update context-menu to use native popover by sissbruecker · Pull Request #9839 · vaadin/web-components · GitHub
Skip to content

Conversation

@sissbruecker
Copy link
Contributor

Description

Updates vaadin-context-menu to use native popovers for its overlay. As part of that overlay content is rendered into a slotted div in the light DOM. Likewise, the submenu is slotted from the light DOM. Also updates vaadin-menu-bar to use the new structure for vaadin-menu-bar-submenu.

Fixes #9714
Fixes #9715

Type of change

  • Breaking change

this._onVaadinOverlayOpen(e);
});

const overlaySlot = document.createElement('slot');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could revert #6870 and keep overlay in the template (and also set id="overlay" on it).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to be a bigger thing? There are multiple observers accessing _overlayElement, which doesn't work if it's only initialized in ready. It seems those would need to be refactored to use updated instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed. I think we can do that in a separate PR.

@sonarqubecloud
Copy link

*
* @returns {HTMLElement}
*/
getFirstChild() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is in the public API, but it wasn't really that useful in the context of this component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed some snapshot tests to check the context menu light DOM.

* - `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
* - `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
* - `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
* - `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For menu bar the <vaadin-menu-bar-submenu> now needs to be targeted for styling. Mentioning it like this seems consistent with other components.

@sissbruecker sissbruecker marked this pull request as ready for review July 30, 2025 13:19
@sissbruecker sissbruecker requested a review from web-padawan July 30, 2025 13:19
@web-padawan web-padawan merged commit 1f39766 into main Jul 30, 2025
10 checks passed
@web-padawan web-padawan deleted the refactor/context-menu-native-popover branch July 30, 2025 14:04
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 25.0.0-beta2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[menu-bar] Update to use native popover for the overlay element [context-menu] Update to use native popover for the overlay element

3 participants