-
Notifications
You must be signed in to change notification settings - Fork 83
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
[lumo] Overlay styles are duplicated if combo box is used together with any other overlay-based component #1697
Comments
What would you want to go with as the top choice? |
Hi @lkraav! My original choice was But then we decided that the bare Now I see
|
Thanks for your thoughts. So for a new project, it would make sense to fork relevant component repos and just do this change while upstream is working on integrating it across all? |
Sorry for the long delay in responding. I’m not sure I understood what you meant (my git terminology is a bit lacking). But I think branches for the relevant components would be the way to go. I would let the core dev team handle the integration. |
@tomivirkki, do you have any instructions/suggestions on how @lkraav could contribute here? |
@tomivirkki your thoughts? Let me know if my question is unclear in some way. |
Not sure if we can do much about 3. Themable mixin already prevents duplicate includes for style modules but I guess the issue here is about the includes that occur within the style modules themselves. So that leaves us with option 2, unless we come up with something else |
@tomivirkki is this a problem inherent to HTML imports? Would we be able to better control this if everything was ES modules? |
Problem
If you just use
<vaadin-select>
,<vaadin-date-picker>
or any other component that internally uses an element based on<vaadin-overlay>
, styles are as expected.When you import and use
<vaadin-combo-box>
together with any of them, the styles for the overlays are duplicated. There’s no visible effect from that, but it looks ugly in Devtools, and it certainly doesn't increase performance.The reason is that combo box imports
vaadin-overlay/theme/lumo/vaadin-overlay.html
which adds a theme module forvaadin-overlay
which includes thelumo-overlay
style module.At the same time, other components do not import
vaadin-overlay/theme/lumo/vaadin-overlay.html
but instead define their own theme modules for their corresponding specialized overlay elements such as<vaadin-select-overlay>
and include thelumo-menu-overlay
style module which then includes thelumo-overlay
style module.As theme modules are included from the inherited component as well, the overlays end up getting the
lumo-overlay
style module twice.Possible solutions
Do not import
vaadin-overlay/theme/lumo/vaadin-overlay.html
from combo-box. This only fixes the symptom, and it will break again if some other component would want to import the plain<vaadin-overlay>
element and use it directly.Let all components import the Lumo styled overlay (like combo box does), and remove the
include="lumo-overlay ..."
from thelumo-menu-overlay
theme module.Add logic to
ThemableMixin
to avoid including the same theme module multiple times. There’s a small risk of breaking something, as this could cause the priority of some selectors to change in users’ apps.The text was updated successfully, but these errors were encountered: