Fix: select add portalRef instead of modalContextId

This commit is contained in:
Johannes Kirschbauer
2025-01-09 10:15:29 +01:00
parent 8bb596cdb5
commit 1058d5ff07
2 changed files with 84 additions and 62 deletions

View File

@@ -5,6 +5,7 @@ import {
type JSX,
For,
createMemo,
Accessor,
} from "solid-js";
import { Portal } from "solid-js/web";
import { useFloating } from "../base";
@@ -46,11 +47,12 @@ interface SelectInputpProps {
placeholder?: string;
multiple?: boolean;
loading?: boolean;
dialogContextId?: string;
portalRef?: Accessor<HTMLElement | null>;
}
export function SelectInput(props: SelectInputpProps) {
const dialogContext = useContext(props.dialogContextId);
const dialogContext = (dialogContextId?: string) =>
useContext(dialogContextId);
const _id = createUniqueId();
@@ -228,7 +230,11 @@ export function SelectInput(props: SelectInputpProps) {
}
/>
<Portal mount={dialogContext.contentRef?.() || document.body}>
<Portal
mount={
props.portalRef ? props.portalRef() || document.body : document.body
}
>
<div
id={_id}
popover