Merge pull request #1657 from lbryio/sticky-autocomplete

fix sticky autocomplete
This commit is contained in:
Sean Yesmunt 2018-06-20 19:59:24 -04:00 committed by GitHub
commit 1e95072722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -190,9 +190,8 @@ export default class Autocomplete extends React.Component {
background: 'rgba(255, 255, 255, 0.9)',
padding: '2px 0',
fontSize: '90%',
position: 'fixed',
position: 'absolute',
overflow: 'hidden',
maxHeight: '50%', // TODO: don't cheat, let it flow to the bottom,
},
autoHighlight: true,
selectOnBlur: false,
@ -410,12 +409,13 @@ export default class Autocomplete extends React.Component {
const node = this.refs.input;
const rect = node.getBoundingClientRect();
const computedStyle = global.window.getComputedStyle(node);
const marginBottom = parseInt(computedStyle.marginBottom, 10) || 0;
// const marginBottom = parseInt(computedStyle.marginBottom, 10) || 0;
const marginLeft = parseInt(computedStyle.marginLeft, 10) || 0;
const marginRight = parseInt(computedStyle.marginRight, 10) || 0;
this.setState({
menuTop: rect.bottom + marginBottom,
menuLeft: rect.left + marginLeft,
// We may need these if we go back to a fixed header
// menuTop: rect.bottom + marginBottom,
// menuLeft: rect.left + marginLeft,
menuWidth: rect.width + marginLeft + marginRight,
});
}

View file

@ -92,7 +92,7 @@ class WunderBar extends React.PureComponent<Props> {
<Icon icon={icons.SEARCH} />
<Autocomplete
autoHighlight
wrapperStyle={{ flex: 1 }}
wrapperStyle={{ flex: 1, position: 'relative' }}
value={wunderbarValue || ''}
items={suggestions}
getItemValue={item => item.value}

View file

@ -10,6 +10,7 @@
position: absolute;
left: 10px;
top: 10px;
z-index: 1;
}
}