Skip to content

Commit 445b9d9

Browse files
committed
apply suggested changes
1 parent cf35439 commit 445b9d9

File tree

5 files changed

+60
-43
lines changed

5 files changed

+60
-43
lines changed

docs/_static/custom.css

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,17 @@ div.admonition.admonition-todo>.admonition-title::before {
184184
display: block;
185185
}
186186

187-
#shortcut.input-group-text {
187+
#shortcut-page.input-group-text {
188188
padding-top: 0;
189189
padding-bottom: 0;
190190
}
191191

192192
#search-form .search-icon {
193193
position: absolute;
194-
top: 50%;
195-
transform: translate(0,-50%);
196194
color: #a4a6a7;
197-
left: 6.875rem;
195+
left: 1.5625rem;
198196
z-index: 100;
197+
align-self: center;
199198
}
200199

201200
#search-form .form-control {
@@ -260,25 +259,21 @@ ul.search li p.context {
260259

261260
/* Search form sidebar */
262261

263-
.bd-search .input-group {
264-
flex-direction: row-reverse;
265-
align-items: center;
266-
}
267-
268262
.bd-search {
269263
font-size: .8rem;
270264
}
271265

266+
#shortcut.input-group-text {
267+
padding-top: 0;
268+
padding-bottom: 0;
269+
}
270+
272271
.bd-search input,
273272
.bd-search .input-group-text {
274273
font-size: .8rem;
275274
padding-left: .5em;
276275
}
277276

278-
.bd-search .input-group-append {
279-
align-self: stretch;
280-
}
281-
282277
.bd-search input {
283278
padding-left: 2.1875rem;
284279
}
@@ -288,6 +283,7 @@ ul.search li p.context {
288283
color: #a4a6a7;
289284
left: .625rem;
290285
z-index: 100;
286+
align-self: center;
291287
}
292288

293289
.input-group-text kbd {

docs/_static/search_shortcut.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,48 @@
44

55
$(document).ready(() => {
66
if (window.location.pathname === '/search.html') {
7-
$('form.bd-search').css('visibility','hidden'); // Hide Sidebar Search field
7+
$('form.bd-search .input-group').hide(); // Hide Sidebar Search field
88

99
$(document).keydown(function(event) {
1010
if ((event.ctrlKey || event.metaKey) && event.key == "k") {
1111
event.preventDefault();
1212
$('#q').focus();
1313
}
1414
});
15-
15+
16+
$('#q').focus(() => {
17+
$('#shortcut-page').hide();
18+
});
19+
$('#q').blur(() => {
20+
$('#shortcut-page').show();
21+
});
22+
23+
1624
} else {
1725
$(document).keydown(function(event) {
1826
if ((event.ctrlKey || event.metaKey) && event.key == "k") {
1927
event.preventDefault();
2028
$('#search-input').focus();
2129
}
2230
});
23-
}
2431

32+
$('#search-input').focus(() => {
33+
$('#shortcut').hide();
34+
});
35+
$('#search-input').blur(() => {
36+
$('#shortcut').show();
37+
});
38+
}
39+
40+
// if OS isn't Mac change visual indication of search field
2541
if (navigator.platform.indexOf('Mac') === -1) {
26-
$('#search-shortcut').html("^"); // if OS isn't Mac change visual indication of search field
42+
$('#search-shortcut').html("^");
43+
$('#search-page-shortcut').html("^");
2744
}
28-
45+
2946
});
47+
48+
function onReset() {
49+
$('#search-form').trigger('reset');
50+
$('#search-form').trigger('submit');
51+
}

docs/_templates/search-field.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
<div class="input-group">
33
<label for="q" class="sr-only">Search string
44
</label>
5+
<i class="fa fa-search fa-lg search-icon" aria-hidden="true"></i>
6+
<input
7+
type="search" name="q" id="search-input"
8+
class="form-control"
9+
placeholder="{{ _(theme_search_bar_text) }}"
10+
aria-labelledby="{{ _(theme_search_bar_text) }}"
11+
value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
12+
/>
513
<div class="input-group-append">
614
<span class="input-group-text" id="shortcut">
715
<kbd id="search-shortcut"></kbd>&nbsp;<kbd>K</kbd>
816
</span>
917
</div>
10-
<i class="search-icon fa fa-search fa-lg" aria-hidden="true"></i>
11-
<input
12-
type="search" name="q" id="search-input"
13-
class="form-control"
14-
placeholder="{{ _(theme_search_bar_text) }}"
15-
aria-labelledby="{{ _(theme_search_bar_text) }}"
16-
value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
17-
/>
1818
</div>
1919
</form>

docs/_templates/search.html

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,25 @@ <h1 id="search-documentation">{{ _('Search') }}</h1>
5050
<div class="input-group col-xl-8 mb-2">
5151
<label for="q" class="sr-only">Search string
5252
</label>
53-
<div class="input-group-prepend">
54-
<span class="input-group-text" id="shortcut">
55-
<kbd id="search-shortcut"></kbd>&nbsp;<kbd>K</kbd>
56-
</span>
57-
</div>
58-
<i class="search-icon fa fa-search fa-lg" aria-hidden="true"></i>
53+
<i class="fas fa-search fa-lg search-icon" aria-hidden="true"></i>
5954
<input
60-
type="search" name="q" id="q"
61-
class="form-control"
62-
placeholder="{{ _(theme_search_bar_text) }}"
63-
aria-labelledby="{{ _(theme_search_bar_text) }}"
64-
value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
55+
type="search" name="q" id="q"
56+
class="form-control"
57+
placeholder="{{ _(theme_search_bar_text) }}"
58+
aria-labelledby="{{ _(theme_search_bar_text) }}"
59+
value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
6560
/>
61+
<div class="input-group-append">
62+
<span class="input-group-text" id="shortcut-page">
63+
<kbd id="search-page-shortcut"></kbd>&nbsp;<kbd>K</kbd>
64+
</span>
65+
</div>
6666
<div class="input-group-append">
6767
<button
68-
type="reset"
69-
class="btn btn-light"
70-
><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
71-
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
72-
</svg></button>
68+
type="button"
69+
onclick="onReset()"
70+
class="btn btn-danger"
71+
><i class="fas fa-times"></i></button>
7372
</div>
7473
<div class="input-group-append">
7574
<button type="submit" class="btn btn-primary">{{ _('search') }}</button>

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
html_logo = "_static/logo.svg"
224224
html_favicon = "_static/favicon.ico"
225225

226-
html_css_files = ["custom.css", ("print.css", {"media": "print"}),"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"]
226+
html_css_files = ["custom.css", ("print.css", {"media": "print"})]
227227

228228
# See http://sphinx-doc.org/ext/todo.html#confval-todo_include_todos
229229
todo_include_todos = True

0 commit comments

Comments
 (0)