Skip to content

Commit

Permalink
fix: fix #dropdown useless key usage and focus setting
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Feb 13, 2020
1 parent cdb99e5 commit a12c452
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/dnb-ui-lib/src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,19 +713,22 @@ export default class Dropdown extends PureComponent {
break

default:
// returns -1 if nothing is found
active_item = this.findItemByValue(keycode(e))
break
}

if (active_item < 0) {
active_item = 0
}
if (active_item > total) {
active_item = total
}
if (active_item !== -1) {
if (active_item < 0) {
active_item = 0
}
if (active_item > total) {
active_item = total
}

if (active_item !== this.state.active_item) {
this.scrollToItem(active_item, { fireSelectEvent: true, event: e })
if (active_item !== this.state.active_item) {
this.scrollToItem(active_item, { fireSelectEvent: true, event: e })
}
}
}

Expand Down

0 comments on commit a12c452

Please sign in to comment.