@@ -81,6 +81,10 @@ export class FilterWidget extends Widget {
8181 private moreFiltersActionViewItem : MoreFiltersActionViewItem | undefined ;
8282 private isMoreFiltersChecked : boolean = false ;
8383
84+ private focusTracker : DOM . IFocusTracker ;
85+ public get onDidFocus ( ) { return this . focusTracker . onDidFocus ; }
86+ public get onDidBlur ( ) { return this . focusTracker . onDidBlur ; }
87+
8488 constructor (
8589 private readonly options : IFilterWidgetOptions ,
8690 @IInstantiationService private readonly instantiationService : IInstantiationService ,
@@ -97,7 +101,7 @@ export class FilterWidget extends Widget {
97101 }
98102
99103 this . element = DOM . $ ( '.viewpane-filter' ) ;
100- this . filterInputBox = this . createInput ( this . element ) ;
104+ [ this . filterInputBox , this . focusTracker ] = this . createInput ( this . element ) ;
101105
102106 const controlsContainer = DOM . append ( this . element , DOM . $ ( '.viewpane-filter-controls' ) ) ;
103107 this . filterBadge = this . createBadge ( controlsContainer ) ;
@@ -106,6 +110,10 @@ export class FilterWidget extends Widget {
106110 this . adjustInputBox ( ) ;
107111 }
108112
113+ hasFocus ( ) : boolean {
114+ return this . filterInputBox . hasFocus ( ) ;
115+ }
116+
109117 focus ( ) : void {
110118 this . filterInputBox . focus ( ) ;
111119 }
@@ -145,7 +153,7 @@ export class FilterWidget extends Widget {
145153 }
146154 }
147155
148- private createInput ( container : HTMLElement ) : ContextScopedHistoryInputBox {
156+ private createInput ( container : HTMLElement ) : [ ContextScopedHistoryInputBox , DOM . IFocusTracker ] {
149157 const inputBox = this . _register ( this . instantiationService . createInstance ( ContextScopedHistoryInputBox , container , this . contextViewService , {
150158 placeholder : this . options . placeholder ,
151159 ariaLabel : this . options . ariaLabel ,
@@ -171,7 +179,7 @@ export class FilterWidget extends Widget {
171179 this . _register ( focusTracker . onDidBlur ( ( ) => this . focusContextKey ! . set ( false ) ) ) ;
172180 this . _register ( toDisposable ( ( ) => this . focusContextKey ! . reset ( ) ) ) ;
173181 }
174- return inputBox ;
182+ return [ inputBox , focusTracker ] ;
175183 }
176184
177185 private createBadge ( container : HTMLElement ) : HTMLElement {
0 commit comments