Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update menu-bar to use vaadin-menu-bar-item component for sub-menus #3010

Closed
web-padawan opened this issue Nov 10, 2021 · 0 comments · Fixed by #5339
Closed

Update menu-bar to use vaadin-menu-bar-item component for sub-menus #3010

web-padawan opened this issue Nov 10, 2021 · 0 comments · Fixed by #5339
Assignees
Labels
enhancement New feature or request refactor Internal improvement requires new major This would be a breaking change theme v24 To be done in V24

Comments

@web-padawan
Copy link
Member

Motivation

Right now we have a weird case where vaadin-menu-bar uses vaadin-context-menu-item:

if (isElement && itemComponent.localName === 'vaadin-context-menu-item') {
component = itemComponent;
} else {
component = document.createElement('vaadin-context-menu-item');
component.appendChild(isElement ? itemComponent : document.createElement(itemComponent));
}

This caused some confusion among the team members, not to mention the actual users.

Proposed solution

  1. Add vaadin-menu-bar-item component that would extend vaadin-context-menu-item.
  2. Update themes to not use hardcoded item tag name - or maybe allow both tag names 🙈

[part='label'] ::slotted(vaadin-context-menu-item) {
justify-content: center;
background-color: transparent;
height: var(--lumo-button-size);
margin: 0 calc((var(--lumo-size-m) / 3 + var(--lumo-border-radius-m) / 2) * -1);
padding-left: calc(var(--lumo-size-m) / 3 + var(--lumo-border-radius-m) / 2);
padding-right: calc(var(--lumo-size-m) / 3 + var(--lumo-border-radius-m) / 2);
}
:host([theme~='small']) [part='label'] ::slotted(vaadin-context-menu-item) {
min-height: var(--lumo-size-s);
margin: 0 calc((var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2) * -1);
padding-left: calc(var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2);
padding-right: calc(var(--lumo-size-s) / 3 + var(--lumo-border-radius-m) / 2);
}
:host([theme~='tertiary']) [part='label'] ::slotted(vaadin-context-menu-item) {
margin: 0 calc((var(--lumo-button-size) / 6) * -1);
padding-left: calc(var(--lumo-button-size) / 6);
padding-right: calc(var(--lumo-button-size) / 6);
}

Note

Similar fix was done in Vaadin 22 for vaadin-time-picker-item extending vaadin-combo-box-item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Internal improvement requires new major This would be a breaking change theme v24 To be done in V24
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants