Skip to content

Commit

Permalink
fixing regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed Apr 7, 2020
1 parent 2b17ec2 commit 386b61e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ exports[`props options list is rendered 1`] = `
id="htmlid_listbox"
role="listBox"
style="height: 270px; width: 100%;"
tabindex="0"
>
<button
aria-selected="false"
Expand Down
5 changes: 5 additions & 0 deletions src/components/combo_box/combo_box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ export class EuiComboBox<T> extends Component<
relatedTarget &&
this.comboBoxRefInstance &&
this.comboBoxRefInstance.contains(relatedTarget);
console.log({ focusEvent, focusedInOptionsList, focusedInInput });
if (!focusedInOptionsList && !focusedInInput) {
this.closeList();

Expand Down Expand Up @@ -652,6 +653,10 @@ export class EuiComboBox<T> extends Component<

if (singleSelection) {
requestAnimationFrame(this.closeList);
} else {
this.setState({
activeOptionIndex: this.state.matchingOptions.indexOf(addedOption),
});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ export class EuiComboBoxOptionsList<T> extends Component<

setListRef = (ref: FixedSizeList | null) => {
this.listRef = ref;

if (ref && this.props.activeOptionIndex) {
ref.scrollToItem(this.props.activeOptionIndex, 'auto');
}
};

setListBoxRef = (ref: HTMLUListElement | null) => {
Expand All @@ -179,6 +175,7 @@ export class EuiComboBoxOptionsList<T> extends Component<
if (ref) {
ref.setAttribute('id', this.props.rootId('listbox'));
ref.setAttribute('role', 'listBox');
ref.setAttribute('tabIndex', '0');
}
};

Expand Down

0 comments on commit 386b61e

Please sign in to comment.