Cleanup autocomplete
This commit is contained in:
parent
e173900808
commit
884abbd7e9
8 changed files with 28 additions and 24 deletions
|
@ -105,7 +105,8 @@ export default class Autocomplete extends React.Component {
|
|||
// this is the selected completion, so scroll it into view if needed
|
||||
const selectedCompletion = this.refs[`completion${this.state.selectionOffset}`];
|
||||
if (selectedCompletion && this.container) {
|
||||
const {offsetTop} = ReactDOM.findDOMNode(selectedCompletion);
|
||||
const domNode = ReactDOM.findDOMNode(selectedCompletion);
|
||||
const offsetTop = domNode && domNode.offsetTop;
|
||||
if (offsetTop > this.container.scrollTop + this.container.offsetHeight ||
|
||||
offsetTop < this.container.scrollTop) {
|
||||
this.container.scrollTop = offsetTop - this.container.offsetTop;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue