Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/great-eggs-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": patch
---

Fix qa prop binding in ComboBox.
13 changes: 5 additions & 8 deletions src/components/fields/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type FilterFn = (textValue: string, inputValue: string) => boolean;
export type PopoverTriggerAction = 'focus' | 'input' | 'manual';

const ComboBoxWrapperElement = tasty({
qa: 'ComboBoxWrapper',
styles: INPUT_WRAPPER_STYLES,
});

Expand Down Expand Up @@ -695,6 +696,7 @@ function useComboBoxKeyboard({
// Component: ComboBoxInput
// ============================================================================
interface ComboBoxInputProps {
qa?: string;
inputRef: RefObject<HTMLInputElement>;
id?: string;
value: string;
Expand All @@ -713,13 +715,12 @@ interface ComboBoxInputProps {
hasResults: boolean;
comboBoxId: string;
listStateRef: RefObject<any>;
isLoading?: boolean;
allowsCustomValue?: boolean;
}

const ComboBoxInput = forwardRef<HTMLInputElement, ComboBoxInputProps>(
function ComboBoxInput(
{
qa,
inputRef,
id,
value,
Expand All @@ -738,8 +739,6 @@ const ComboBoxInput = forwardRef<HTMLInputElement, ComboBoxInputProps>(
hasResults,
comboBoxId,
listStateRef,
isLoading,
allowsCustomValue,
},
ref,
) {
Expand All @@ -748,7 +747,7 @@ const ComboBoxInput = forwardRef<HTMLInputElement, ComboBoxInputProps>(
return (
<InputElement
ref={combinedRef}
qa="Input"
qa={qa}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: ComboBox Input QA Prop Inheritance Issue

The InputElement within ComboBox no longer defaults to qa="Input". Instead, its qa prop is directly set from the ComboBox's qa prop, which can be undefined. This removes a consistent identifier for the input field, breaking existing QA selectors and making it harder to target the input for testing.

Fix in Cursor Fix in Web

id={id}
type="text"
value={value}
Expand Down Expand Up @@ -1565,7 +1564,6 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
const comboBoxField = (
<ComboBoxWrapperElement
ref={wrapperRef}
qa={qa || 'ComboBox'}
mods={mods}
styles={styles}
style={{
Expand All @@ -1576,6 +1574,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
>
{prefix ? <div data-element="Prefix">{prefix}</div> : null}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: ComboBox Wrapper QA Attribute Overwritten

The ComboBoxWrapperElement now has a hardcoded qa attribute, preventing the qa prop from the ComboBox component from customizing the root wrapper's QA identifier. It always defaults to 'ComboBoxWrapper'.

Additional Locations (1)

Fix in Cursor Fix in Web

<ComboBoxInput
qa={qa || 'ComboBox'}
inputRef={inputRef}
id={id}
value={effectiveInputValue}
Expand All @@ -1592,8 +1591,6 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
hasResults={hasResults}
comboBoxId={comboBoxId}
listStateRef={listStateRef}
isLoading={isLoading}
allowsCustomValue={allowsCustomValue}
onChange={handleInputChange}
onFocus={handleInputFocus}
/>
Expand Down
Loading