This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
src/components/structures Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -118,19 +118,17 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
118118 this . setState ( { query : this . inputRef . current . value } ) ;
119119 } ;
120120
121- private onMouseDown = ( ev : React . MouseEvent < HTMLInputElement > ) => {
121+ private onFocus = ( ev : React . FocusEvent < HTMLInputElement > ) => {
122122 if ( SettingsStore . getValue ( "feature_spotlight" ) ) {
123123 ev . preventDefault ( ) ;
124124 ev . stopPropagation ( ) ;
125125 this . openSpotlight ( ) ;
126+ } else {
127+ this . setState ( { focused : true } ) ;
128+ ev . target . select ( ) ;
126129 }
127130 } ;
128131
129- private onFocus = ( ev : React . FocusEvent < HTMLInputElement > ) => {
130- this . setState ( { focused : true } ) ;
131- ev . target . select ( ) ;
132- } ;
133-
134132 private onBlur = ( ev : React . FocusEvent < HTMLInputElement > ) => {
135133 this . setState ( { focused : false } ) ;
136134 } ;
@@ -156,7 +154,11 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
156154 } ;
157155
158156 public focus = ( ) : void => {
159- this . inputRef . current ?. focus ( ) ;
157+ if ( SettingsStore . getValue ( "feature_spotlight" ) ) {
158+ this . openSpotlight ( ) ;
159+ } else {
160+ this . inputRef . current ?. focus ( ) ;
161+ }
160162 } ;
161163
162164 public render ( ) : React . ReactNode {
@@ -181,7 +183,6 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
181183 ref = { this . inputRef }
182184 className = { inputClasses }
183185 value = { this . state . query }
184- onMouseDown = { this . onMouseDown }
185186 onFocus = { this . onFocus }
186187 onBlur = { this . onBlur }
187188 onChange = { this . onChange }
You can’t perform that action at this time.
0 commit comments