+ {normalizedSlug}
+
+ {isOpen
+ ? filterItems(items, itemToString, inputValue).map(
+ (item, index) => {
+ const isObject = item !== null && typeof item === 'object';
+ const title =
+ isObject && 'text' in item && itemToElement
+ ? item.text?.toString()
+ : itemToString(item);
+ const itemProps = getItemProps({
+ item,
+ index,
+ });
+
+ // The initial implementation using would place the disabled attribute
+ // on disabled menu items. Conversely, useCombobox places aria-disabled instead.
+ // To avoid any potential breaking changes, we avoid placing aria-disabled and
+ // instead match the old behavior of placing the disabled attribute.
+ const disabled = itemProps['aria-disabled'];
+ const {
+ 'aria-disabled': unusedAriaDisabled, // eslint-disable-line @typescript-eslint/no-unused-vars
+ ...modifiedItemProps
+ } = itemProps;
+
+ return (
+
+ {ItemToElement ? (
+
+ ) : (
+ itemToString(item)
+ )}
+ {selectedItem === item && (
+
+ )}
+
+ );
+ }
+ )
+ : null}
+
+
+ {helperText && !invalid && !warn && !isFluid && (
+
+ {helperText}
+
+ )}
+
);
}
);
@@ -856,8 +840,9 @@ ComboBox.propTypes = {
/**
* Additional props passed to Downshift
*/
- // @ts-ignore
- downshiftProps: PropTypes.shape(Downshift.propTypes),
+ downshiftProps: PropTypes.object as React.Validator<
+ UseComboboxProps
+ >,
/**
* Provide helper text that is used alongside the control label for
* additional help
diff --git a/packages/react/src/components/FluidComboBox/__tests__/FluidComboBox-test.js b/packages/react/src/components/FluidComboBox/__tests__/FluidComboBox-test.js
index 7598fa7a5bc7..7d7647edcf65 100644
--- a/packages/react/src/components/FluidComboBox/__tests__/FluidComboBox-test.js
+++ b/packages/react/src/components/FluidComboBox/__tests__/FluidComboBox-test.js
@@ -21,7 +21,7 @@ const prefix = 'cds';
const findInputNode = () => screen.getByRole('combobox');
const openMenu = async () => {
- await userEvent.click(findInputNode());
+ await userEvent.click(screen.getByTitle('Open'));
};
describe('FluidComboBox', () => {
@@ -55,7 +55,7 @@ describe('FluidComboBox', () => {
it('should display the menu of items when a user clicks on the input', async () => {
render();
- await userEvent.click(findInputNode());
+ await openMenu();
assertMenuOpen(mockProps);
});
diff --git a/packages/react/src/components/ListBox/next/ListBoxTrigger.js b/packages/react/src/components/ListBox/next/ListBoxTrigger.js
index 9ca2c0598090..996f97f6cfcf 100644
--- a/packages/react/src/components/ListBox/next/ListBoxTrigger.js
+++ b/packages/react/src/components/ListBox/next/ListBoxTrigger.js
@@ -27,6 +27,7 @@ const defaultTranslateWithId = (id) => defaultTranslations[id];
* `ListBoxTrigger` is used to orient the icon up or down depending on the
* state of the menu for a given `ListBox`
*/
+
const ListBoxTrigger = React.forwardRef(function ListBoxTrigger(
{ isOpen, translateWithId: t = defaultTranslateWithId, ...rest },
ref