Skip to content

Commit

Permalink
Switch back to absolute positioning and remove scroll listener to imp…
Browse files Browse the repository at this point in the history
…rove performance, particularly on IE11.
  • Loading branch information
cjcenizal committed Apr 4, 2018
1 parent 3e5b363 commit 9ad1c82
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class EuiComboBox extends Component {

const { position, left, top } = calculatePopoverPosition(comboBoxBounds, this.listBounds, 'bottom', 0, ['bottom', 'top']);

this.optionsList.style.top = `${top}px`;
this.optionsList.style.top = `${top + window.scrollY}px`;
this.optionsList.style.left = `${left}px`;
this.optionsList.style.width = `${comboBoxBounds.width}px`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/**
* 1. Make width match that of the input and tweak position to match.
* 2. We can't use absolute position here because this will cause a scrollbar to show up when
* the portal is appended to the body. This throws off our logic for positioning the
* 2. Put the list at the top of the screen, otherwise it will cause a scrollbar to show up when
* the portal is appended to the body. This would throw off our logic for positioning the
* list beneath the input.
*/
.euiComboBoxOptionsList {
@include euiFormControlSize;
box-sizing: content-box; /* 1 */
margin-left: -1px; /* 1 */
z-index: $euiZComboBox;
position: fixed; /* 2 */
position: absolute; /* 2 */
top: 0; /* 2 */
}

.euiComboBoxOptionsList--bottom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export class EuiComboBoxOptionsList extends Component {
componentDidMount() {
this.updatePosition();
window.addEventListener('resize', this.updatePosition);
window.addEventListener('scroll', this.updatePosition);
}

componentWillUpdate(nextProps) {
Expand All @@ -66,7 +65,6 @@ export class EuiComboBoxOptionsList extends Component {

componentWillUnmount() {
window.removeEventListener('resize', this.updatePosition);
window.removeEventListener('scroll', this.updatePosition);
}

listRef = node => {
Expand Down

0 comments on commit 9ad1c82

Please sign in to comment.