@@ -81,6 +81,10 @@ export class FilterWidget extends Widget {
81
81
private moreFiltersActionViewItem : MoreFiltersActionViewItem | undefined ;
82
82
private isMoreFiltersChecked : boolean = false ;
83
83
84
+ private focusTracker : DOM . IFocusTracker ;
85
+ public get onDidFocus ( ) { return this . focusTracker . onDidFocus ; }
86
+ public get onDidBlur ( ) { return this . focusTracker . onDidBlur ; }
87
+
84
88
constructor (
85
89
private readonly options : IFilterWidgetOptions ,
86
90
@IInstantiationService private readonly instantiationService : IInstantiationService ,
@@ -97,7 +101,7 @@ export class FilterWidget extends Widget {
97
101
}
98
102
99
103
this . element = DOM . $ ( '.viewpane-filter' ) ;
100
- this . filterInputBox = this . createInput ( this . element ) ;
104
+ [ this . filterInputBox , this . focusTracker ] = this . createInput ( this . element ) ;
101
105
102
106
const controlsContainer = DOM . append ( this . element , DOM . $ ( '.viewpane-filter-controls' ) ) ;
103
107
this . filterBadge = this . createBadge ( controlsContainer ) ;
@@ -106,6 +110,10 @@ export class FilterWidget extends Widget {
106
110
this . adjustInputBox ( ) ;
107
111
}
108
112
113
+ hasFocus ( ) : boolean {
114
+ return this . filterInputBox . hasFocus ( ) ;
115
+ }
116
+
109
117
focus ( ) : void {
110
118
this . filterInputBox . focus ( ) ;
111
119
}
@@ -145,7 +153,7 @@ export class FilterWidget extends Widget {
145
153
}
146
154
}
147
155
148
- private createInput ( container : HTMLElement ) : ContextScopedHistoryInputBox {
156
+ private createInput ( container : HTMLElement ) : [ ContextScopedHistoryInputBox , DOM . IFocusTracker ] {
149
157
const inputBox = this . _register ( this . instantiationService . createInstance ( ContextScopedHistoryInputBox , container , this . contextViewService , {
150
158
placeholder : this . options . placeholder ,
151
159
ariaLabel : this . options . ariaLabel ,
@@ -171,7 +179,7 @@ export class FilterWidget extends Widget {
171
179
this . _register ( focusTracker . onDidBlur ( ( ) => this . focusContextKey ! . set ( false ) ) ) ;
172
180
this . _register ( toDisposable ( ( ) => this . focusContextKey ! . reset ( ) ) ) ;
173
181
}
174
- return inputBox ;
182
+ return [ inputBox , focusTracker ] ;
175
183
}
176
184
177
185
private createBadge ( container : HTMLElement ) : HTMLElement {
0 commit comments