Skip to content

Commit d643b4b

Browse files
authored
fix: set display to none on the popover host element (#7671)
1 parent adf4da0 commit d643b4b

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packages/popover/src/vaadin-popover.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
66
import './vaadin-popover-overlay.js';
7-
import { html, LitElement } from 'lit';
7+
import { css, html, LitElement } from 'lit';
88
import { ifDefined } from 'lit/directives/if-defined.js';
99
import {
1010
getDeepActiveElement,
@@ -190,6 +190,14 @@ class Popover extends PopoverPositionMixin(
190190
return 'vaadin-popover';
191191
}
192192

193+
static get styles() {
194+
return css`
195+
:host {
196+
display: none !important;
197+
}
198+
`;
199+
}
200+
193201
static get properties() {
194202
return {
195203
/**

packages/popover/test/basic.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ describe('popover', () => {
2929
});
3030
});
3131

32+
describe('host element', () => {
33+
it('should set display: none on the host element by default', () => {
34+
expect(getComputedStyle(popover).display).to.equal('none');
35+
});
36+
37+
it('should enforce display: none to hide the host element', () => {
38+
popover.style.display = 'block';
39+
expect(getComputedStyle(popover).display).to.equal('none');
40+
});
41+
});
42+
3243
describe('renderer', () => {
3344
let renderer;
3445

0 commit comments

Comments
 (0)