Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

[changed]Set the position of menu as "absolute" instead of "fixed" #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ let Autocomplete = React.createClass({
background: 'rgba(255, 255, 255, 0.9)',
padding: '2px 0',
fontSize: '90%',
position: 'fixed',
position: 'absolute',
overflow: 'auto',
maxHeight: '50%', // TODO: don't cheat, let it flow to the bottom
maxHeight: Math.max(document.documentElement.clientHeight, window.innerHeight || 0)/2 +'px',
}
}
},
Expand Down Expand Up @@ -217,12 +217,9 @@ let Autocomplete = React.createClass({
var node = this.refs.input
var rect = node.getBoundingClientRect()
var computedStyle = getComputedStyle(node)
var marginBottom = parseInt(computedStyle.marginBottom, 10)
var marginLeft = parseInt(computedStyle.marginLeft, 10)
var marginRight = parseInt(computedStyle.marginRight, 10)
this.setState({
menuTop: rect.bottom + marginBottom,
menuLeft: rect.left + marginLeft,
menuWidth: rect.width + marginLeft + marginRight
})
},
Expand Down Expand Up @@ -298,7 +295,7 @@ let Autocomplete = React.createClass({
})
}
return (
<div style={{display: 'inline-block'}}>
<div style={{display: 'inline-block', position: 'relative'}}>
<input
{...this.props.inputProps}
role="combobox"
Expand Down