Skip to content

Too strict approach when hiding host element in Popover component #7979

@tomerlichtash

Description

@tomerlichtash

Description

In a recent commit to the new Popover component the host element was set to hidden (see #7671), so it will be aligned with other modal-related components hidden host (see #3597).

However, in Popover, you use Lit's static get styles function, while in other components, like Dialog, you use a style tag in the template to achieve the same result (see https://github.com/vaadin/web-components/blob/main/packages/dialog/src/vaadin-dialog.js#L99).

I was wondering if the latter approach, of using Lit to enforce static CSS, is not too harsh, and if it would be possible to maintain the template style approach instead.

I myself have a use case where I internalize the overlay to be within the shadow DOM (so it won't be affected from other styles in the page) and I need to override the hidden root style. While I was able to achieve this result with Dialog, it seems that in Popover there is no way to do it.

Expected outcome

<style>
  :host {
    display: none !important;
  }
 </style>

instead of

static get styles() {
    return css`
      :host {
        display: none !important;
      }
    `;
  }

Minimal reproducible example

...

Steps to reproduce

...

Environment

Vaadin version(s): 24.5.0

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedvaadin-popoverwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions