From d6b4c6ea7d3d4ddb14e7eda8f286c39e3e02bc9e Mon Sep 17 00:00:00 2001 From: Florian Stancioiu Date: Thu, 11 Apr 2024 12:06:08 +0300 Subject: [PATCH] feat: remove portal call --- src/listbox/index.ts | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/listbox/index.ts b/src/listbox/index.ts index 8cb41b0c..1bc42222 100644 --- a/src/listbox/index.ts +++ b/src/listbox/index.ts @@ -5,7 +5,6 @@ import { virtualizerRef, } from '@lit-labs/virtualizer/virtualize.js'; import { sheet } from '@neovici/cosmoz-utils'; -import { portal } from '@neovici/cosmoz-utils/directives/portal'; import { spreadProps } from '@neovici/cosmoz-utils/directives/spread-props'; import { useStyleSheet } from '@neovici/cosmoz-utils/hooks/use-stylesheet'; import { props } from '@neovici/cosmoz-utils/object'; @@ -56,9 +55,11 @@ const supportsPopover = () => { const showPopover = (popover?: Element) => { const popoverElement = popover as HTMLElement; - requestAnimationFrame(() => { - popoverElement?.showPopover(); - }); + if (supportsPopover()) { + requestAnimationFrame(() => { + popoverElement?.showPopover(); + }); + } }; customElements.define( @@ -70,21 +71,11 @@ export const listbox = ({ multi, ...thru }: Props & { multi?: boolean }) => { - if (supportsPopover()) { - return html``; - } - - return portal( - html``, - ); + return html``; };