Skip to content

Commit

Permalink
fix: Hide menu when editable is filtered and no options are available
Browse files Browse the repository at this point in the history
  • Loading branch information
HriBB committed Aug 20, 2016
1 parent da25a71 commit e2f6137
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/SelectField/SelectField.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ export default class SelectField extends Component {

const children = this.getChildren()

const mainClass = classnames({
'mdl-selectfield': true,
const mainClass = classnames('mdl-selectfield', {
'mdl-selectfield--editable': editable,
'mdl-selectfield--empty': !children.length,
'mdl-selectfield--error': error,
}, className)

Expand Down Expand Up @@ -241,7 +241,7 @@ export default class SelectField extends Component {
/>}

{!readOnly &&
<Menu target={this.id} ripple>
<Menu target={this.id}>
{Children.map(children, child => {
const className = classnames({
'mdl-menu__item--selected': !multiple && child.props.value === value,
Expand Down Expand Up @@ -272,7 +272,7 @@ export default class SelectField extends Component {
let selectFieldIndex = 0

/**
* Has override been applied
* Has override been applied?
*
* @type {Boolean}
*/
Expand Down
6 changes: 6 additions & 0 deletions src/SelectField/SelectField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
}
}

&.mdl-selectfield--empty {
.mdl-menu__container {
display: none;
}
}

&.mdl-selectfield--error {
.mdl-selectfield__arrow {
color: #d50000;
Expand Down

0 comments on commit e2f6137

Please sign in to comment.