Skip to content

Commit

Permalink
Fix #6058 Dropdown: Select value with Enter when optionValue is set (#…
Browse files Browse the repository at this point in the history
…6703)

* Fix: Remove setTokens in onPaste on InputOtp to avoid duplicate values

- When pasted the value into InputOtp, was duplicating the value, as the state was updated in onPaste and onInput

* Update InputOtp.js

* Fix #6058 Dropdown: Select value with Enter when optionValue is set

---------

Co-authored-by: Datacamp <[email protected]>
Co-authored-by: Melloware <[email protected]>
Co-authored-by: Gabriell Reis Alvarenga <[email protected]>
  • Loading branch information
4 people authored May 29, 2024
1 parent 5feb844 commit c246fac
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/lib/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,9 @@ export const Dropdown = React.memo(
};

const onOptionSelect = (event, option, isHide = true) => {
const value = getOptionValue(option);

selectItem({
originalEvent: event,
option: value
option
});

isHide && hide(true);
Expand Down Expand Up @@ -754,6 +752,7 @@ export const Dropdown = React.memo(
updateEditableLabel(event.option);
setFocusedOptionIndex(-1);
const optionValue = getOptionValue(event.option);

const selectedOptionIndex = findOptionIndexInList(event.option, visibleOptions);

if (props.onChange) {
Expand Down

0 comments on commit c246fac

Please sign in to comment.