Skip to content

Commit

Permalink
fix(ui-time-select): fix nonpersistent event issue in Timeselect with…
Browse files Browse the repository at this point in the history
… react 16

Closes: INSTUI-3856
  • Loading branch information
HerrTopi committed Sep 11, 2023
1 parent 523f548 commit 77bc913
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/ui-time-select/src/TimeSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,12 @@ class TimeSelect extends Component<TimeSelectProps, TimeSelectState> {
) => {
if (data.id === this._emptyOptionId) return
const option = this.getOption('id', data.id)!.label

// this is needed for react 16. When we no longer support it, this can be removed
const eventType = event.type
this.setState((state) => ({
highlightedOptionId: data.id,
inputValue: event.type === 'keydown' ? option : state.inputValue
inputValue: eventType === 'keydown' ? option : state.inputValue
}))
}

Expand Down

0 comments on commit 77bc913

Please sign in to comment.