Skip to content

Commit 0e61a4d

Browse files
Merge pull request #640 from thejackshelton/main
fix(docs): select examples on safari not showing up because relative …
2 parents e52ceab + 6b17b5d commit 0e61a4d

File tree

9 files changed

+16
-17
lines changed

9 files changed

+16
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const ContextChild = component$(() => {
3030
const animals = useContext(AnimalContext);
3131

3232
return (
33-
<Combobox options={animals} class="relative">
33+
<Combobox options={animals}>
3434
<ComboboxLabel class=" font-semibold">Animals 🐖</ComboboxLabel>
3535
<ComboboxControl class="rounded-base relative flex items-center border">
3636
<ComboboxInput class="px-d2 bg-background placeholder:text-muted-foreground w-44 px-2 pr-6" />

apps/website/src/routes/docs/headless/combobox/examples/custom-filter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default component$(() => {
4040
})
4141
}
4242
>
43-
<ComboboxLabel class=" font-semibold">Countries 🚩</ComboboxLabel>
43+
<ComboboxLabel class="font-semibold">Countries 🚩</ComboboxLabel>
4444
<ComboboxControl class="rounded-base relative flex items-center border">
4545
<ComboboxInput class="px-d2 bg-background placeholder:text-muted-foreground rounded-base w-44 px-2 pr-6" />
4646
<ComboboxTrigger class="group absolute right-0 h-6 w-6">

apps/website/src/routes/docs/headless/combobox/examples/custom-keys.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default component$(() => {
3939
});
4040

4141
return (
42-
<div class="relative">
42+
<div>
4343
{isPokemonCaught.value && (
4444
<p class="bg-background rounded-base absolute w-full translate-x-[-105%] border-2 p-4 shadow-md">
4545
You've already caught this pokemon!

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export default component$(() => {
4141
optionValueKey="testValue"
4242
optionLabelKey="testLabel"
4343
optionDisabledKey="disabled"
44-
class="relative"
4544
bind:selectedIndex={selectedOptionIndexSig}
4645
>
4746
<ComboboxLabel class="font-semibold">Personal Trainers ⚡</ComboboxLabel>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default component$(() => {
1818

1919
return (
2020
<div
21-
class="relative flex h-[10rem] w-full flex-col items-center gap-4"
21+
class="flex h-[10rem] w-full flex-col items-center gap-4"
2222
style={{ overflow: 'auto', width: '100%' }}
2323
>
2424
<div class="h-[1px] w-[2000px]"></div>

apps/website/src/routes/docs/headless/select/examples/select.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
}
44

55
.select {
6-
position: relative;
76
min-width: var(--select-width);
87
}
98

109
.select-trigger {
1110
width: 100%;
1211
border: 2px dashed hsla(var(--primary) / 1);
1312
border-radius: calc(var(--border-radius) / 2);
13+
height: 44px;
1414
}
1515

1616
.select-popover {

apps/website/src/routes/docs/headless/select/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ The above example increments a count when the user selects a new option.
157157

158158
We can select an initial uncontrolled value by passing the `value` prop to the `<Select />` root component.
159159

160-
### Uncontrolled
160+
### Uncontrolled / Initial value
161161

162162
<div data-testid="select-uncontrolled-test">
163163
<Showcase name="uncontrolled" />
@@ -167,9 +167,9 @@ The above example passes one of the option values "Jessie" as the initial value.
167167

168168
> The `value` prop in Qwik is similar to a `defaultValue` prop in other frameworks. For controlled values, we use signals and the bind syntax.
169169
170-
### Controlled
170+
### Controlled / Reactive value
171171

172-
We can select a controlled value by passing the `bind:value` prop to the `<Select />` root component.
172+
We can pass reactive state by using the `bind:value` prop to the `<Select />` root component.
173173

174174
<div data-testid="select-controlled-test">
175175
<Showcase name="controlled" />

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const FloatingPopover = component$(
8080
const popoverRef = props.popoverRef || myRef;
8181

8282
// sets floating UI config
83-
useTask$(({ track, cleanup }) => {
83+
useTask$(async ({ track, cleanup }) => {
8484
const anchor = track(() => anchorRef?.value);
8585
const popover = track(() => popoverRef.value);
8686
if (!popover || !anchor) return;
@@ -99,7 +99,7 @@ export const FloatingPopover = component$(
9999
await computePosition(anchor as ReferenceElement, popover, {
100100
placement,
101101
middleware,
102-
}).then((resolvedData) => {
102+
}).then(async (resolvedData) => {
103103
const { x, y } = resolvedData;
104104

105105
Object.assign(popover.style, {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { component$, useContext, Slot, useTask$, useId } from '@builder.io/qwik';
1+
import { component$, useContext, Slot, useTask$ } from '@builder.io/qwik';
22
import { Popover, usePopover } from '../popover';
33

44
import SelectContextId from './select-context';
@@ -9,25 +9,25 @@ import { isServer } from '@builder.io/qwik/build';
99
export const SelectPopover = component$(
1010
(props: Partial<FloatingProps & PopoverImplProps>) => {
1111
const context = useContext(SelectContextId);
12-
const customPopoverId = useId();
13-
const { showPopover, hidePopover } = usePopover(customPopoverId);
12+
const popoverId = `${context.localId}-popover`;
13+
const { showPopover, hidePopover } = usePopover(popoverId);
1414

1515
useTask$(async ({ track }) => {
1616
track(() => context.isListboxOpenSig.value);
1717

1818
if (isServer) return;
1919

2020
if (context.isListboxOpenSig.value) {
21-
showPopover();
21+
await showPopover();
2222
} else {
23-
hidePopover();
23+
await hidePopover();
2424
}
2525
});
2626

2727
return (
2828
<Popover
2929
{...props}
30-
id={customPopoverId}
30+
id={popoverId}
3131
floating={true}
3232
anchorRef={context.triggerRef}
3333
ref={context.popoverRef}

0 commit comments

Comments
 (0)