Skip to content

Commit

Permalink
add throttle to incrementActiveOptionIndex to avoid keypresses gettin…
Browse files Browse the repository at this point in the history
…g UI out of sync
  • Loading branch information
nreese committed Apr 17, 2018
1 parent d7172a5 commit 88c1476
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* from the tab order with tabindex="-1" so that we can control the keyboard navigation interface.
*/

import _ from 'lodash';
import React, {
Component,
} from 'react';
Expand Down Expand Up @@ -149,7 +150,7 @@ export class EuiComboBox extends Component {
tabbableItems[comboBoxIndex + amount].focus();
};

incrementActiveOptionIndex = amount => {
incrementActiveOptionIndex = _.throttle(amount => {
// If there are no options available, reset the focus.
if (!this.matchingOptions.length) {
this.clearActiveOption();
Expand Down Expand Up @@ -188,7 +189,7 @@ export class EuiComboBox extends Component {
this.setState({
activeOptionIndex: nextActiveOptionIndex,
});
};
}, 200);

hasActiveOption = () => {
return this.state.activeOptionIndex !== undefined;
Expand Down

0 comments on commit 88c1476

Please sign in to comment.