File tree Expand file tree Collapse file tree 2 files changed +38
-21
lines changed
packages/frontend/src/components/SearchInput Expand file tree Collapse file tree 2 files changed +38
-21
lines changed Original file line number Diff line number Diff line change @@ -41,28 +41,39 @@ export default function SearchInput(props: Props) {
41
41
42
42
return (
43
43
< >
44
- < input
45
- id = { id }
46
- placeholder = { tx ( 'search' ) }
47
- aria-label = { tx ( 'search' ) }
48
- aria-description = { tx ( 'search_explain' ) }
49
- autoFocus
50
- onChange = { onChange }
51
- value = { value }
52
- className = { styles . searchInput }
53
- data-no-drag-region
54
- ref = { props . inputRef }
55
- spellCheck = { false }
56
- // FYI there is also Ctrl + Shift + F to search in chat.
57
- aria-keyshortcuts = 'Control+F'
58
- />
59
- { hasValue && (
60
- < SearchInputButton
61
- aria-label = { tx ( 'clear_search' ) }
62
- icon = 'cross'
63
- onClick = { handleClear }
44
+ < div
45
+ role = 'search'
46
+ // `aria-label={tx('search')}` is not required,
47
+ // a "search" landmark is enough.
48
+ // Note that `_explain` strings are generally verbose
49
+ // and are more suitable for `aria-description`,
50
+ // but here it's fine to use it as the label.
51
+ // We must speecify the label, because we have multiple searches
52
+ // in the app, another one being the attachments search.
53
+ aria-label = { tx ( 'search_explain' ) }
54
+ className = { styles . inputAndClearButton }
55
+ >
56
+ < input
57
+ id = { id }
58
+ placeholder = { tx ( 'search' ) }
59
+ autoFocus
60
+ onChange = { onChange }
61
+ value = { value }
62
+ className = { styles . searchInput }
63
+ data-no-drag-region
64
+ ref = { props . inputRef }
65
+ spellCheck = { false }
66
+ // FYI there is also Ctrl + Shift + F to search in chat.
67
+ aria-keyshortcuts = 'Control+F'
64
68
/>
65
- ) }
69
+ { hasValue && (
70
+ < SearchInputButton
71
+ aria-label = { tx ( 'clear_search' ) }
72
+ icon = 'cross'
73
+ onClick = { handleClear }
74
+ />
75
+ ) }
76
+ </ div >
66
77
{ ! hasValue && (
67
78
< SearchInputButton
68
79
aria-label = { tx ( 'qrscan_title' ) }
Original file line number Diff line number Diff line change 1
1
$borderRadius : 10px ;
2
2
$closeButtonSize : 30px ;
3
3
4
+ .inputAndClearButton {
5
+ flex : 1 ;
6
+ display : flex ;
7
+ align-items : center ;
8
+ }
9
+
4
10
.searchInput {
5
11
background-color : var (--searchInputBackgroundColor );
6
12
border-radius : $borderRadius ;
You can’t perform that action at this time.
0 commit comments