Skip to content

Commit

Permalink
Some EuiSuperSelect fixes (#1295)
Browse files Browse the repository at this point in the history
  • Loading branch information
cchaos authored Nov 7, 2018
1 parent f7fbd94 commit 99464ed
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `5.0.0`.
**Bug fixes**

- Fixed size of `EuiSuperSelect`'s dropdown menu when there is no initial selection ([#1295](https://github.com/elastic/eui/pull/1295))

## [`5.0.0`](https://github.com/elastic/eui/tree/v5.0.0)

- Added `EuiToken` component ([#1270](https://github.com/elastic/eui/pull/1270))
- Added `EuiToken` component ([#1270](https://github.com/elastic/eui/pull/1270))
- Added `beaker` icon to `EuiIcon` and updated the `EuiBetaBadge` styling ([#1291](https://github.com/elastic/eui/pull/1291/))
- Removed calls to deprecated `findDOMNode` ([#1285](https://github.com/elastic/eui/pull/1285))

Expand Down
8 changes: 8 additions & 0 deletions src/components/form/super_select/_super_select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
@include euiBottomShadowFlat; /* 2 */
}

.euiSuperSelect__item {
&:hover,
&:focus {
text-decoration: none;
background-color: $euiFocusBackgroundColor;
}
}

.euiSuperSelect__item--hasDividers:not(:last-of-type) {
border-bottom: $euiBorderThin;
}
2 changes: 2 additions & 0 deletions src/components/form/super_select/_super_select_control.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/**
* 1. Leave room for caret.
* 2. Ensure the descenders don't get cut off
* 3. Makes sure the height is correct when there's no selection
*/

.euiSuperSelectControl {
@include euiFormControlStyle;
@include euiFormControlWithIcon($side: "right"); /* 1 */
@include euiFormControlIsLoading($isNextToIcon: true);
display: block; /* 3 */
text-align: left;

line-height: $euiFormControlHeight; /* 2 */
Expand Down
24 changes: 12 additions & 12 deletions src/components/form/super_select/super_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ export class EuiSuperSelect extends Component {
null
);

// valueOfSelected is optional, and options may not exist yet
if (indexOfSelected != null) {
// wait for the CSS classes to be applied, removing visibility: hidden
requestAnimationFrame(() => {
this.focusItemAt(indexOfSelected);

this.setState({
menuWidth: this.popoverRef.getBoundingClientRect().width - 2, // account for border not inner shadow
});
requestAnimationFrame(() => {
this.setState({
menuWidth: this.popoverRef.getBoundingClientRect().width - 2, // account for border not inner shadow
});
} else {
requestAnimationFrame(focusSelected);
}

if (this.props.valueOfSelected != null) {
if (indexOfSelected != null) {
this.focusItemAt(indexOfSelected);
} else {
focusSelected();
}
}
});
};

requestAnimationFrame(focusSelected);
Expand Down

0 comments on commit 99464ed

Please sign in to comment.