@@ -39,6 +39,7 @@ interface State {
39
39
isBlockedVisible : boolean ;
40
40
anonymousUsernameInputValue : string ;
41
41
threshold : number ;
42
+ sortSelectFocused : boolean ;
42
43
}
43
44
44
45
export class AuthPanel extends Component < Props , State > {
@@ -51,6 +52,7 @@ export class AuthPanel extends Component<Props, State> {
51
52
isBlockedVisible : false ,
52
53
anonymousUsernameInputValue : 'anon' ,
53
54
threshold : 3 ,
55
+ sortSelectFocused : false ,
54
56
} ;
55
57
56
58
this . toggleBlockedVisibility = this . toggleBlockedVisibility . bind ( this ) ;
@@ -91,6 +93,16 @@ export class AuthPanel extends Component<Props, State> {
91
93
}
92
94
}
93
95
96
+ onSortFocus = ( ) => {
97
+ this . setState ( { sortSelectFocused : true } ) ;
98
+ } ;
99
+
100
+ onSortBlur = ( e : Event ) => {
101
+ this . setState ( { sortSelectFocused : false } ) ;
102
+
103
+ this . onSortChange ( e ) ;
104
+ } ;
105
+
94
106
toggleBlockedVisibility ( ) {
95
107
if ( ! this . state . isBlockedVisible ) {
96
108
if ( this . props . onBlockedUsersShow ) this . props . onBlockedUsersShow ( ) ;
@@ -336,13 +348,21 @@ export class AuthPanel extends Component<Props, State> {
336
348
337
349
renderSort = ( ) => {
338
350
const { sort } = this . props ;
351
+ const { sortSelectFocused } = this . state ;
339
352
const sortArray = getSortArray ( sort ) ;
340
353
return (
341
354
< span className = "auth-panel__sort" >
342
355
Sort by{ ' ' }
343
356
< span className = "auth-panel__select-label" >
344
- { sortArray . find ( x => 'selected' in x && x . selected ! ) ! . label }
345
- < select className = "auth-panel__select" onChange = { this . onSortChange } onBlur = { this . onSortChange } >
357
+ < span className = { b ( 'auth-panel__select-label-value' , { } , { focused : sortSelectFocused } ) } >
358
+ { sortArray . find ( x => 'selected' in x && x . selected ! ) ! . label }
359
+ </ span >
360
+ < select
361
+ className = "auth-panel__select"
362
+ onChange = { this . onSortChange }
363
+ onFocus = { this . onSortFocus }
364
+ onBlur = { this . onSortBlur }
365
+ >
346
366
{ sortArray . map ( sort => (
347
367
< option value = { sort . value } selected = { sort . selected } >
348
368
{ sort . label }
0 commit comments