You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
keep filter field expanded if it has text in it
This commit is contained in:
@ -81,7 +81,7 @@ const LeftPanel = createReactClass({
|
|||||||
if (this.state.searchFilter !== nextState.searchFilter) {
|
if (this.state.searchFilter !== nextState.searchFilter) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.state.searchFocused !== nextState.searchFocused) {
|
if (this.state.searchExpanded !== nextState.searchExpanded) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +206,7 @@ const LeftPanel = createReactClass({
|
|||||||
if (source === "keyboard") {
|
if (source === "keyboard") {
|
||||||
dis.dispatch({action: 'focus_composer'});
|
dis.dispatch({action: 'focus_composer'});
|
||||||
}
|
}
|
||||||
|
this.setState({searchExpanded: false});
|
||||||
},
|
},
|
||||||
|
|
||||||
collectRoomList: function(ref) {
|
collectRoomList: function(ref) {
|
||||||
@ -213,11 +214,13 @@ const LeftPanel = createReactClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onSearchFocus: function() {
|
_onSearchFocus: function() {
|
||||||
this.setState({searchFocused: true});
|
this.setState({searchExpanded: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSearchBlur: function() {
|
_onSearchBlur: function(event) {
|
||||||
this.setState({searchFocused: false});
|
if (event.target.value.length === 0) {
|
||||||
|
this.setState({searchExpanded: false});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
@ -255,7 +258,7 @@ const LeftPanel = createReactClass({
|
|||||||
let exploreButton;
|
let exploreButton;
|
||||||
if (!this.props.collapsed) {
|
if (!this.props.collapsed) {
|
||||||
exploreButton = (
|
exploreButton = (
|
||||||
<div className={classNames("mx_LeftPanel_explore", {"mx_LeftPanel_explore_hidden": this.state.searchFocused})}>
|
<div className={classNames("mx_LeftPanel_explore", {"mx_LeftPanel_explore_hidden": this.state.searchExpanded})}>
|
||||||
<AccessibleButton onClick={() => dis.dispatch({action: 'view_room_directory'})}>{_t("Explore")}</AccessibleButton>
|
<AccessibleButton onClick={() => dis.dispatch({action: 'view_room_directory'})}>{_t("Explore")}</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user