Skip to content

Commit 43abfcb

Browse files
fix(popover): works for supported browsers too
1 parent 60b517a commit 43abfcb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/kit-headless/src/components/popover/popover-trigger.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ type PopoverTriggerProps = {
88
} & QwikIntrinsicElements['button'];
99

1010
export function usePopover(popovertarget: string) {
11-
/* NEEDS TO RUN BEFORE POLYFILL LOAD, ALSO ONLY DYNAMIC IMPORT */
12-
const isSupported =
13-
typeof HTMLElement !== 'undefined' &&
14-
typeof HTMLElement.prototype === 'object' &&
15-
'popover' in HTMLElement.prototype;
16-
1711
const hasPolyfillLoadedSig = useSignal<boolean>(false);
1812
const didClickSig = useSignal<boolean>(false);
1913

@@ -23,6 +17,12 @@ export function usePopover(popovertarget: string) {
2317
});
2418

2519
const initPopover$ = $(async () => {
20+
/* needs to run before poly load */
21+
const isSupported =
22+
typeof HTMLElement !== 'undefined' &&
23+
typeof HTMLElement.prototype === 'object' &&
24+
'popover' in HTMLElement.prototype;
25+
2626
if (!hasPolyfillLoadedSig.value && !isSupported) {
2727
await loadPolyfill$();
2828
hasPolyfillLoadedSig.value = true;

0 commit comments

Comments
 (0)