Skip to content

Commit 5b181b8

Browse files
authored
Trigger search modal on "Search docs" input focus (#1610)
This is a regression introduced in #1601 This PR triggers the search modal when clicking on the "Search docs" input from - inside the flyout if present - the top left navbar
1 parent 7deb68f commit 5b181b8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

sphinx_rtd_theme/static/js/versions.js_t

+11-9
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,7 @@ if (themeFlyoutDisplay === "attached") {
132132
const event = new CustomEvent("readthedocs-search-show");
133133
document.dispatchEvent(event);
134134
});
135-
136-
// Trigger the Read the Docs Addons Search modal when clicking on "Search docs" input from the topnav.
137-
document
138-
.querySelector("[role='search'] input")
139-
.addEventListener("focusin", () => {
140-
const event = new CustomEvent("readthedocs-search-show");
141-
document.dispatchEvent(event);
142-
});
143-
});
135+
})
144136
}
145137

146138
if (themeLanguageSelector || themeVersionSelector) {
@@ -220,3 +212,13 @@ if (themeLanguageSelector || themeVersionSelector) {
220212
}
221213
});
222214
}
215+
216+
document.addEventListener("readthedocs-addons-data-ready", function (event) {
217+
// Trigger the Read the Docs Addons Search modal when clicking on "Search docs" input from the topnav.
218+
document
219+
.querySelector("[role='search'] input")
220+
.addEventListener("focusin", () => {
221+
const event = new CustomEvent("readthedocs-search-show");
222+
document.dispatchEvent(event);
223+
});
224+
});

0 commit comments

Comments
 (0)