diff --git a/packages/@react-aria/combobox/src/useComboBox.ts b/packages/@react-aria/combobox/src/useComboBox.ts index 5246611f875..2a7f8e83102 100644 --- a/packages/@react-aria/combobox/src/useComboBox.ts +++ b/packages/@react-aria/combobox/src/useComboBox.ts @@ -218,6 +218,8 @@ export function useComboBox(props: AriaCo let {isInvalid, validationErrors, validationDetails} = state.displayValidation; let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({ ...props, + // In multi-select mode, only set required if the selection is empty. + isRequired: props.selectionMode === 'multiple' ? props.isRequired && state.selectionManager.isEmpty : props.isRequired, onChange: state.setInputValue, onKeyDown: !isReadOnly ? chain(state.isOpen && collectionProps.onKeyDown, onKeyDown, props.onKeyDown) : props.onKeyDown, onBlur, diff --git a/packages/@react-aria/dnd/src/useDroppableCollection.ts b/packages/@react-aria/dnd/src/useDroppableCollection.ts index 555c75e9380..8d7c90b27ab 100644 --- a/packages/@react-aria/dnd/src/useDroppableCollection.ts +++ b/packages/@react-aria/dnd/src/useDroppableCollection.ts @@ -251,9 +251,9 @@ export function useDroppableCollection(props: DroppableCollectionOptions, state: state.selectionManager.isSelectionEqual(prevSelectedKeys) ) { let newKeys = new Set(); - for (let key of state.collection.getKeys()) { - if (!prevCollection.getItem(key)) { - newKeys.add(key); + for (let item of state.collection) { + if (item.type === 'item' && !prevCollection.getItem(item.key)) { + newKeys.add(item.key); } } diff --git a/packages/@react-stately/combobox/src/useComboBoxState.ts b/packages/@react-stately/combobox/src/useComboBoxState.ts index b09765212dd..9871666532c 100644 --- a/packages/@react-stately/combobox/src/useComboBoxState.ts +++ b/packages/@react-stately/combobox/src/useComboBoxState.ts @@ -481,10 +481,10 @@ export function useComboBoxState { expect(onChange).toHaveBeenLastCalledWith(['1']); }); + it('should support isRequired with multiple selection', async () => { + let {container, getByTestId} = render( +
+ + + +