/* * Portions of this file are based on code from react-spectrum. * Apache License Version 2.0, Copyright 2020 Adobe. * * Credits to the React Spectrum team: * https://github.com/adobe/react-spectrum/blob/0a1d0cd4e1b2f77eed7c0ea08fce8a04f8de6921/packages/@react-aria/select/src/HiddenSelect.tsx */ import { callHandler, mergeRefs, visuallyHiddenStyles } from "@kobalte/utils"; import { type ComponentProps, For, Show, createEffect, createSignal, on, splitProps, } from "solid-js"; import { useFormControlContext } from "../form-control"; import type { Collection, CollectionNode } from "../primitives"; import type { SelectionManager } from "../selection"; import { isSameSelection } from "../selection/utils"; // In Safari, the whereas other browsers // seem to identify it just by surrounding text. // The solution is to use to hide the elements, which clips the elements to a // 1px rectangle. In addition, we hide from screen readers with aria-hidden, and make the for this also works, but Safari on iOS briefly flashes // the native menu on focus, so this isn't ideal. A font-size of 16px or greater is required to // prevent Safari from zooming in on the input when it is focused. // // If the current interaction modality is null, then the user hasn't interacted with the page yet. // In this case, we set the tabIndex to -1 on the input element so that automated accessibility // checkers don't throw false-positives about focusable elements inside an aria-hidden parent. export interface HiddenSelectBaseProps extends ComponentProps<"select"> { collection: Collection; selectionManager: SelectionManager; isOpen: boolean; isMultiple: boolean; isVirtualized: boolean; focusTrigger: () => void; } /** * Renders a hidden native ` so the value can be submitted to a server. // Otherwise, render all options so that browser autofill will work. return ( ); }