-
Notifications
You must be signed in to change notification settings - Fork 6
fix(ComboBox): qa prop #832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, | ||
| }); | ||
|
|
||
|
|
@@ -695,6 +696,7 @@ function useComboBoxKeyboard({ | |
| // Component: ComboBoxInput | ||
| // ============================================================================ | ||
| interface ComboBoxInputProps { | ||
| qa?: string; | ||
| inputRef: RefObject<HTMLInputElement>; | ||
| id?: string; | ||
| value: string; | ||
|
|
@@ -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, | ||
|
|
@@ -738,8 +739,6 @@ const ComboBoxInput = forwardRef<HTMLInputElement, ComboBoxInputProps>( | |
| hasResults, | ||
| comboBoxId, | ||
| listStateRef, | ||
| isLoading, | ||
| allowsCustomValue, | ||
| }, | ||
| ref, | ||
| ) { | ||
|
|
@@ -748,7 +747,7 @@ const ComboBoxInput = forwardRef<HTMLInputElement, ComboBoxInputProps>( | |
| return ( | ||
| <InputElement | ||
| ref={combinedRef} | ||
| qa="Input" | ||
| qa={qa} | ||
| id={id} | ||
| type="text" | ||
| value={value} | ||
|
|
@@ -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={{ | ||
|
|
@@ -1576,6 +1574,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>( | |
| > | ||
| {prefix ? <div data-element="Prefix">{prefix}</div> : null} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: ComboBox Wrapper QA Attribute OverwrittenThe Additional Locations (1) |
||
| <ComboBoxInput | ||
| qa={qa} | ||
|
||
| inputRef={inputRef} | ||
| id={id} | ||
| value={effectiveInputValue} | ||
|
|
@@ -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} | ||
| /> | ||
|
|
||
There was a problem hiding this comment.
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
InputElementwithinComboBoxno longer defaults toqa="Input". Instead, itsqaprop is directly set from theComboBox'sqaprop, which can beundefined. This removes a consistent identifier for the input field, breaking existing QA selectors and making it harder to target the input for testing.