Skip to content

Commit c58f131

Browse files
committed
use id
1 parent 0741fea commit c58f131

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ var findSearchInput = () => {
194194
} else {
195195
// must be at least one persistent form, use the first persistent one
196196
form = document.querySelector(
197-
":not(.search-button__search-container) > form.bd-search",
197+
":not(#pst-search-dialog) > form.bd-search",
198198
);
199199
}
200200
return form.querySelector("input");
@@ -212,9 +212,7 @@ var toggleSearchField = () => {
212212

213213
// if the input field is the hidden one (the one associated with the
214214
// search button) then toggle the button state (to show/hide the field)
215-
const searchDialog = document.querySelector(
216-
".search-button__search-container",
217-
);
215+
const searchDialog = document.getElementById("pst-search-dialog");
218216
const hiddenInput = searchDialog.querySelector("input");
219217
if (input === hiddenInput) {
220218
if (searchDialog.open) {
@@ -306,9 +304,7 @@ var setupSearchButtons = () => {
306304
});
307305

308306
// If user clicks outside the search modal dialog, then close it.
309-
const searchDialog = document.querySelector(
310-
".search-button__search-container",
311-
);
307+
const searchDialog = document.getElementById("pst-search-dialog");
312308
searchDialog.addEventListener("click", (event) => {
313309
if (!searchDialog.open) {
314310
return;

src/pydata_sphinx_theme/assets/styles/components/_search.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
/**
7979
* The search pop-up <dialog>
8080
*/
81-
.search-button__search-container {
81+
#pst-search-dialog {
8282
display: none;
8383

8484
&[open] {

src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
id="pst-secondary-sidebar-checkbox"/>
6464
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
6565
{# A search field pop-up that will only show when the search button is clicked #}
66-
<dialog class="search-button__search-container">
66+
<dialog class="#pst-search-dialog">
6767
{% include "../components/search-field.html" %}
6868
</dialog>
6969

0 commit comments

Comments
 (0)