0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-22 04:38:11 +00:00

combobox fix

This commit is contained in:
Víctor Losada Hernández
2026-03-03 22:39:29 +01:00
parent 4ddd1b7774
commit 828bba61de

View File

@@ -21,6 +21,7 @@ const Combobox = createReactClass({
};
},
getInitialState : function() {
this.dropdownRef = React.createRef();
return {
showDropdown : false,
value : '',
@@ -41,7 +42,7 @@ const Combobox = createReactClass({
},
handleClickOutside : function(e){
// Close dropdown when clicked outside
if(this.refs.dropdown && !this.refs.dropdown.contains(e.target)) {
if (this.dropdownRef.current && !this.dropdownRef.current.contains(e.target)) {
this.handleDropdown(false);
}
},
@@ -128,7 +129,7 @@ const Combobox = createReactClass({
});
return (
<div className={`dropdown-container ${this.props.className}`}
ref='dropdown'
ref={this.dropdownRef}
onMouseLeave={this.props.trigger == 'hover' ? ()=>{this.handleDropdown(false);} : undefined}>
{this.renderTextInput()}
{this.renderDropdown(dropdownChildren)}