@@ -50,6 +50,16 @@ export const ActionBarFilter = forwardRef<ActionBarFilterHandle, ActionBarFilter
50
50
inputRef . current . value = '' ;
51
51
setFilterText ( '' ) ;
52
52
props . onFilterTextChanged ( '' ) ;
53
+ // Move focus back to the input after clearing the text.
54
+ inputRef . current . focus ( ) ;
55
+ } ;
56
+
57
+ // Button clear key down handler.
58
+ const buttonClearKeyDownHandler = ( e : React . KeyboardEvent < HTMLButtonElement > ) => {
59
+ if ( e . code === 'Enter' || e . code === 'Space' ) {
60
+ e . preventDefault ( ) ;
61
+ buttonClearClickHandler ( ) ;
62
+ }
53
63
} ;
54
64
55
65
useImperativeHandle ( ref , ( ) => ( {
@@ -67,16 +77,21 @@ export const ActionBarFilter = forwardRef<ActionBarFilterHandle, ActionBarFilter
67
77
< input
68
78
ref = { inputRef }
69
79
className = 'text-input'
70
- placeholder = { ( ( ) => localize ( 'positronFilterPlaceholder' , "filter " ) ) ( ) }
80
+ placeholder = { ( ( ) => localize ( 'positronFilterPlaceholder' , "Filter " ) ) ( ) }
71
81
type = 'text'
72
82
value = { filterText }
73
83
onBlur = { ( ) => setFocused ( false ) }
74
84
onChange = { changeHandler }
75
85
onFocus = { ( ) => setFocused ( true ) }
76
86
/>
77
87
{ filterText !== '' && (
78
- < button className = 'clear-button' >
79
- < div className = { 'codicon codicon-positron-search-cancel' } onClick = { buttonClearClickHandler } />
88
+ < button
89
+ aria-label = { ( ( ) => localize ( 'positronClearFilter' , "Clear filter" ) ) ( ) }
90
+ className = 'clear-button'
91
+ onClick = { buttonClearClickHandler }
92
+ onKeyDown = { buttonClearKeyDownHandler }
93
+ >
94
+ < div className = { 'codicon codicon-positron-search-cancel' } />
80
95
</ button >
81
96
) }
82
97
</ div >
0 commit comments