Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion components/base/select/combobox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import type { FocusEventHandler, PointerEventHandler, RefAttributes, RefObject } from "react";
import type { FocusEventHandler, MouseEventHandler, PointerEventHandler, RefAttributes, RefObject } from "react";
import { useCallback, useContext, useRef, useState } from "react";
import { SearchLg as SearchIcon } from "@untitledui/icons";
import type { ComboBoxProps as AriaComboBoxProps, GroupProps as AriaGroupProps, ListBoxProps as AriaListBoxProps } from "react-aria-components";
Expand Down Expand Up @@ -39,6 +39,12 @@ const ComboBoxValue = ({ size, shortcut, placeholder, shortcutClassName, ...othe
const first = inputValue?.split(value?.supportingText)?.[0] || "";
const last = inputValue?.split(first)[1];

const handleInputMouseDown: MouseEventHandler<HTMLInputElement> = () => {
if (state && !state.isOpen) {
state.open();
}
};

return (
<AriaGroup
{...otherProps}
Expand All @@ -65,6 +71,7 @@ const ComboBoxValue = ({ size, shortcut, placeholder, shortcutClassName, ...othe

<AriaInput
placeholder={placeholder}
onMouseDown={handleInputMouseDown}
className="z-10 w-full appearance-none bg-transparent text-md text-transparent caret-alpha-black/90 placeholder:text-placeholder focus:outline-hidden disabled:cursor-not-allowed disabled:text-disabled disabled:placeholder:text-disabled"
/>
</div>
Expand Down