Skip to content

Commit

Permalink
Use !important to override CSS top property.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed Apr 4, 2018
1 parent 9ad1c82 commit c8a3116
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ export class EuiComboBox extends Component {

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

this.optionsList.style.top = `${top + window.scrollY}px`;
this.optionsList.style.left = `${left}px`;
this.optionsList.style.width = `${comboBoxBounds.width}px`;
// We use !important to override the style set by the CSS class. We have to use setAttribute
// over setting properties on the style object because that won't work with !important.
this.optionsList.setAttribute(
'style',
`top: ${top + window.scrollY}px !important; left: ${left}px; width: ${comboBoxBounds.width}px;`
);

this.setState({
listPosition: position,
Expand Down

0 comments on commit c8a3116

Please sign in to comment.