File tree Expand file tree Collapse file tree 3 files changed +62
-49
lines changed Expand file tree Collapse file tree 3 files changed +62
-49
lines changed Original file line number Diff line number Diff line change 2
2
3
3
module . exports = {
4
4
extends : [ 'octane' , 'a11y' ] ,
5
-
6
- pending : [ { moduleId : 'app/components/header' , only : [ 'no-duplicate-landmark-elements' ] } ] ,
7
5
} ;
Original file line number Diff line number Diff line change 5
5
<h1 >crates.io</h1 >
6
6
</LinkTo >
7
7
8
- <form local-class =" desktop-search-form" action =' /search' {{ on " submit" (prevent-default this.search )}} data-test-search-form>
8
+ <form local-class =" search-form" action =' /search' role =" search" {{ on " submit" (prevent-default this.search )}} data-test-search-form>
9
+ {{! template-lint-disable require-input-label}}
10
+ {{! disabled due to https://github.com/ember-template-lint/ember-template-lint/issues/2141 }}
9
11
<input
10
12
type =" text"
11
- local-class =" search"
13
+ local-class =" search-input-lg "
12
14
name =" q"
13
15
id =" cargo-desktop-search"
14
16
placeholder =" Click or press 'S' to search..."
19
21
autofocus =" autofocus"
20
22
spellcheck =" false"
21
23
required
24
+ aria-label =" Search"
22
25
data-test-search-input
23
26
>
24
- <label for =" cargo-desktop-search" local-class =" search-label" >Search</label >
27
+
28
+ {{! Second input fields for narrow screens because CSS does not allow us to change the placeholder }}
29
+ <input
30
+ type =" text"
31
+ local-class =" search-input-sm"
32
+ name =" q"
33
+ placeholder =" Search"
34
+ value ={{ this.header.searchValue }}
35
+ oninput ={{ this.updateSearchValue }}
36
+ autocorrect =" off"
37
+ required
38
+ aria-label =" Search"
39
+ >
40
+
41
+ {{! Hidden submit button to enable enter-to-submit behavior for form with multiple inputs }}
42
+ <button type =" submit" local-class =" submit-button" >Submit</button >
43
+
25
44
{{ on-key ' s' (focus ' #cargo-desktop-search' )}}
26
45
{{ on-key ' S' (focus ' #cargo-desktop-search' )}}
27
46
{{ on-key ' shift+s' (focus ' #cargo-desktop-search' )}}
142
161
</dd .Menu>
143
162
</Dropdown >
144
163
</div >
145
-
146
- <form local-class =' mobile-search' action =' /search' {{ on " submit" (prevent-default this.search )}} >
147
- <input
148
- type =" text"
149
- local-class =" search"
150
- name =" q"
151
- id =" cargo-mobile-search"
152
- placeholder =" Search"
153
- value ={{ this.header.searchValue }}
154
- oninput ={{ this.updateSearchValue }}
155
- autocorrect =" off"
156
- required
157
- >
158
- <label for =" cargo-mobile-search" local-class =" search-label" >Search</label >
159
- </form >
160
164
</div >
161
165
</header >
Original file line number Diff line number Diff line change 8
8
composes : width-limit from '../styles/application.module.css' ;
9
9
10
10
display : grid;
11
- grid-template-columns : auto 1fr auto;
11
+ grid-template :
12
+ "logo search nav" auto /
13
+ auto 1fr auto;
12
14
align-items : center;
13
- padding : 10px ;
15
+ padding : 10px 20 px ;
14
16
color : white;
15
17
16
18
a {
17
19
color : white; text-decoration : none;
18
20
& : hover { color : white; }
19
21
}
22
+
23
+ @media only screen and (max-width : 900px ) {
24
+ grid-template :
25
+ "logo search menu" auto /
26
+ auto 1fr auto;
27
+ }
28
+
29
+ @media only screen and (max-width : 820px ) {
30
+ grid-template :
31
+ "logo menu" auto
32
+ "search search" auto /
33
+ auto 1fr ;
34
+ }
20
35
}
21
36
22
37
.index-link {
38
+ grid-area : logo;
23
39
display : flex;
24
40
align-items : center;
25
41
31
47
.logo {
32
48
width : 60px ;
33
49
height : auto;
50
+ /* negative margin to account for blank space in the image */
51
+ margin-left : -10px ;
34
52
margin-right : 10px ;
35
53
}
36
54
37
- .desktop-search-form {
55
+ .search-form {
56
+ grid-area : search;
38
57
display : flex;
39
- flex-grow : 1 ;
40
-
41
- @media only screen and (max-width : 820px ) {
42
- display : none;
43
- }
44
58
}
45
59
46
- input .search {
60
+ .search-input {
47
61
font-size : 90% ;
48
62
border : none;
49
63
color : black;
50
64
width : 100% ;
51
- margin-left : 16px ;
52
- margin-right : 16px ;
53
65
padding : 5px 5px 5px 25px ;
54
66
background-color : white;
55
67
background-image : url ('/assets/search.png' );
@@ -66,28 +78,28 @@ input.search {
66
78
}
67
79
}
68
80
69
- .mobile-search {
70
- display : none;
71
- grid-row : 2 ;
72
- grid-column : span 3 ;
73
- margin : 0 10px 10px ;
81
+ .search-input-lg {
82
+ composes : search-input;
83
+ margin-left : 16px ;
84
+ margin-right : 16px ;
74
85
75
- input . search {
76
- margin : 0 ;
86
+ @media only screen and ( max-width : 820 px ) {
87
+ display : none ;
77
88
}
89
+ }
90
+
91
+ .search-input-sm {
92
+ composes : search-input;
93
+ display : none;
94
+ margin : 10px 0 ;
78
95
79
96
@media only screen and (max-width : 820px ) {
80
- display : block ;
97
+ display : unset ;
81
98
}
82
99
}
83
100
84
- .search-label {
85
- position : absolute;
86
- left : -10000px ;
87
- top : auto;
88
- width : 1px ;
89
- height : 1px ;
90
- overflow : hidden;
101
+ .submit-button {
102
+ display : none;
91
103
}
92
104
93
105
.sep {
@@ -101,20 +113,19 @@ input.search {
101
113
}
102
114
103
115
.nav {
116
+ grid-area : nav;
104
117
display : flex;
105
118
align-items : center;
106
119
text-align : right;
107
- margin-right : 5px ;
108
120
109
121
@media only screen and (max-width : 900px ) {
110
122
display : none;
111
123
}
112
124
}
113
125
114
126
.menu {
127
+ grid-area : menu;
115
128
text-align : right;
116
- margin-right : 5px ;
117
- flex-grow : 2 ;
118
129
display : none;
119
130
120
131
@media only screen and (max-width : 900px ) {
You can’t perform that action at this time.
0 commit comments