diff --git a/src/components/dropdown/Dropdown.js b/src/components/dropdown/Dropdown.js index 7a40d8be50..4596f89581 100644 --- a/src/components/dropdown/Dropdown.js +++ b/src/components/dropdown/Dropdown.js @@ -616,10 +616,12 @@ export class Dropdown extends Component { } if (items) { - return items.map((option) => { + return items.map((option, index) => { let optionLabel = this.getOptionLabel(option); + let optionKey = this.getOptionKey(option, index); + return ( - + ); }); } @@ -649,8 +651,8 @@ export class Dropdown extends Component { return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : (option['value'] !== undefined ? option['value'] : option); } - getOptionKey(option) { - return this.props.dataKey ? ObjectUtils.resolveFieldData(option, this.props.dataKey) : this.getOptionLabel(option); + getOptionKey(option, index) { + return this.props.dataKey ? ObjectUtils.resolveFieldData(option, this.props.dataKey) : `pr_id__${this.getOptionLabel}-${index}`; } checkValidity() { diff --git a/src/components/listbox/ListBox.js b/src/components/listbox/ListBox.js index 2528add91a..193772d675 100644 --- a/src/components/listbox/ListBox.js +++ b/src/components/listbox/ListBox.js @@ -278,9 +278,10 @@ export class ListBox extends Component { items = items.map((option, index) => { let optionLabel = this.getOptionLabel(option); + let optionKey = `pr_id__${optionLabel}-${index}`; return ( - this.onOptionTouchEnd(e, option, index)} tabIndex={this.props.tabIndex} /> ); });