Skip to content

Commit 5b2b1c8

Browse files
fix(popover combobox): fixes floating ui flicker, animations
1 parent dd77f60 commit 5b2b1c8

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

apps/website/src/routes/docs/headless/combobox/examples/hero.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/website/src/routes/docs/headless/combobox/examples/hero.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
} from '@qwik-ui/headless';
1313

1414
import { component$ } from '@builder.io/qwik';
15-
import './hero.css';
1615

1716
export default component$(() => {
1817
const objectExample = [

apps/website/src/routes/docs/headless/popover/examples/listbox-animation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export default component$(() => {
2828
2929
@keyframes fadeOut {
3030
from {
31-
opacity: 0;
31+
opacity: 1;
3232
}
3333
to {
34-
opacity: 1;
34+
opacity: 0;
3535
}
3636
}
3737

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ export const FloatingPopover = component$(
8585
const anchor = track(() => anchorRef?.value);
8686
const popover = track(() => popoverRef.value);
8787
if (!popover || !anchor) return;
88-
89-
console.log('INSIDE FLOATING: ', popoverRef.value);
88+
popover.hidden = false;
9089

9190
const updatePosition = async () => {
9291
const middleware = [
@@ -108,7 +107,6 @@ export const FloatingPopover = component$(
108107
// ensures no exit animation when anchor is hidden.
109108
popover.hidden = true;
110109
} else {
111-
popover.hidden = false;
112110
Object.assign(popover.style, {
113111
left: `${x}px`,
114112
top: `${y}px`,
@@ -133,7 +131,7 @@ export const FloatingPopover = component$(
133131
});
134132

135133
return (
136-
<PopoverImpl {...props} ref={popoverRef}>
134+
<PopoverImpl hidden={true} {...props} ref={popoverRef}>
137135
<Slot />
138136
</PopoverImpl>
139137
);

packages/kit-headless/src/components/popover/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function supportShowAnimation(popover: HTMLElement, isPolyfill: boolean)
1111
setTimeout(() => {
1212
popover.classList.add('popover-showing');
1313
popover.classList.remove('popover-closing');
14-
}, 5);
14+
}, 10);
1515
} else {
1616
popover.classList.add('popover-showing');
1717
popover.classList.remove('popover-closing');

0 commit comments

Comments
 (0)